sublinks / sublinks-frontend

MIT License
17 stars 5 forks source link

Update user auth and cache #158

Closed kgilles closed 3 months ago

kgilles commented 3 months ago

When the user auth changes through log in or out we need to make sure the site immediately recognizes this change and renders the app as expected in both cases.

This PR makes sure the getSite cache is cleared in these situations to make sure we receive the most up to date user object. Plus introduces new server actions to make sure the auth states for the client and server both match.

Thanks to the updates to server auth and cache handling there should no more be any UI flashes because of auth state mismatch. Except the dark/light theme setting, as that's still 100% managed in the browser.

kgilles commented 3 months ago

@slickplaid Added you specifically since you had some great feedback reg. this stuff in the past. In case you have time to look at it.

While this doesn't upgrade the JWT management there are some improvements around auth and hydration.