Is subscribing to cache clearance an idiomatic way of handling user logout? #8520
Unanswered
audunolsen
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The way I would handle user logout is:
redirecting should trigger a re-render of some sorts, so when the login page tries to render, it will see that the user is not logged in and will render the login form accordingly. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When calling
queryClient.clear()
nothing really happens in the UI until a re-render comes along. So to "notify" of a logout high up in my app's component tree using only React Query, i usequeryCache.subscribe
and trigger a re-render based on the correct conditions so that no stale user data is left around anywhere in the UI. However, this feels "smelly". Is it? What's recommended here?Beta Was this translation helpful? Give feedback.
All reactions