Problem
Normally, a connected user looks like this:
But sometimes, a user can get in a state where they have a sessionID still remembered in local storage, without proper auth0 cookies and we wind up in this state:
This is annoying to deal with as we debug because it's hard to tell if the user is logged in at a first glance (they're half-logged in in the sense that the game server remembers their sessionID, but they lack auth0 authentication, so they'll lack avatar setting / saved deck selections, etc.)
Solution
1.) Although it's not efficient, I made all the SWR fetcher's function factories that generate each time the components re-renders. This mitigates an issue where sometimes the components render and don't have access to the cookie yet, necessitating a refresh. The idea here is that the cookie will be retrieved
2.) Added a login button for users partially logged in:
Problem Normally, a connected user looks like this:
But sometimes, a user can get in a state where they have a sessionID still remembered in local storage, without proper auth0 cookies and we wind up in this state:
This is annoying to deal with as we debug because it's hard to tell if the user is logged in at a first glance (they're half-logged in in the sense that the game server remembers their sessionID, but they lack auth0 authentication, so they'll lack avatar setting / saved deck selections, etc.)
Solution 1.) Although it's not efficient, I made all the SWR fetcher's function factories that generate each time the components re-renders. This mitigates an issue where sometimes the components render and don't have access to the cookie yet, necessitating a refresh. The idea here is that the cookie will be retrieved 2.) Added a login button for users partially logged in: