T
TanStack3y ago
rival-black

React-query for session management

Hello all, a while back there was a ticket about next-auth not working properly with react-query(suspense mode), however I really like the way it handles session as for example if you are logged in tab one and open another tab(2) once you are logged out in one it logs you out on all of them, is this behavior something possible with react-query, I was messing around and thought maybe using some stale time or window refocus would be possible, my inital thought would be something like this, you would have a query at the _app level and this query just read the cookie using cookie-next packages and then use windowrefocus? https://codesandbox.io/p/sandbox/async-rgb-4lqpxm?embed=1&file=/src/pages/index.js:4,1 I have added a codesanbox if anyone would help with this would be great, one less package to depend on
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?