It was very easy to get in a state where the user has genuinely logged into their account, but the cookie is stale.
How did we fix it?
Overhauled the cookie management system from being based on cookiejs to one based on the useCookies hook library.
The reason we needed to do that was that our SWR calls need to update when cookies update. Logging in sets a cookie, which in turn causes the bearer token to the SWR calls to change. We need our SWR calls to be reactive to cookie changes, so this is the fix that we need (as we can't directly spy on cookie.get() values without the help of this useCookies library)
Strengthened tests to include the Saved Decks Manager
What was the problem
It was very easy to get in a state where the user has genuinely logged into their account, but the cookie is stale.
How did we fix it?
cookiejs
to one based on theuseCookies
hook library.useCookies
library)