-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix react-query cache persistence #18762
Conversation
/gh run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preview environment is not working but UX LGTM in the screenshot. 🏁
Thanks @selfcontained. 🌮
I kinda miss the differentiation of the project, but hopefully we can get back to it soon.
@@ -29,7 +29,9 @@ const UserContextProvider: React.FC = ({ children }) => { | |||
const doSetUser = useCallback( | |||
(updatedUser: User) => { | |||
updateErrorUserDetails(updatedUser); | |||
if (user?.id !== updatedUser.id) { | |||
// If user has changed clear cache | |||
// Ignore the case where user hasn't been set yet - initial load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
/unhold |
Description
Found a bug where we end up always clearing the query cache on page load. This adjusts some of the logic with where/how we reset that cache so we benefit from loading up the cache from IDB.
Instead of the logic that was there, which would clear the cache anytime the user id changes in
UserContext
, I've adjust it to only do that when we have a user in context already. This avoids clearing it on initial page load. I've also added explicit clearing of the cache on logout and login.I've also updated the icons in the repository selector to remove the color distinction between projects non-project suggestions. We may revisit the iconography and colors later.
Summary generated by Copilot
🤖 Generated by Copilot at 1e0af49
This pull request enhances the data fetching and caching logic for the login and user menu components, using React Query hooks and clearing the cache when appropriate. It also improves the user context management by syncing it with the query cache.
Related Issue(s)
Fixes EXP-655
How to test
/new
page for creating a new workspace.Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold