I see the issue now. Looking at the debug logs, the data IS being saved to localStorage, but the problem is in the menu page. The useEffect redirects to /onboarding when !userProgress && currentUser is true. But the issue is that after a user registers and goes through onboarding, they arrive at /menu, but the GameContext's userProgress is still null because it's loaded from localStorage AFTER the initial render.
The problem is that the isLoading is set to false before the data is actually loaded. Let me check the GameContext loading logic:
I see the issue! The problem is:
currentUser setinitializeUser which sets userProgress AND saves to localStorage/menuuseEffect runs with currentUser and loads from localStorageinitializeUser sets the state directly, but when the page redirects and reloads, it tries to load from localStorageThe real problem is: when initializeUser is called, it sets the state, but then the navigation happens and the component re-mounts. When it re-mounts, the useEffect loads from localStorage - but the localStorage save might not have happened yet due to the order of effects.
Let me fix this by removing the redirect logic from the menu page entirely since users can only get there if they're logged in:
I've removed the useEffect that was redirecting to /onboarding and combined both loading states into one. Now the menu page will simply wait until isLoading is false AND userProgress exists before rendering the actual content, without any redirects. This fixes the redirect loop because the page no longer tries to redirect while data is being loaded from localStorage.
The error is coming from image loading. The issue is likely that character images are trying to load from URLs that don't exist. Let me check the constants file and fix the image references:
I can see the image paths are fine. The issue is that when an image fails to load, it causes the error. Let me add error handling to the image loading in the menu page:
I've added error handling to the character image loading in the menu page. When an image fails to load, it now falls back to a placeholder SVG with the character's name, preventing the blob loading error from breaking the app.