From afee92d7c23ce4be14d28f62b245725873382546 Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Mon, 16 Sep 2024 13:22:29 -0400 Subject: [PATCH 1/2] update the profile cache manually rather than doing an invalidation --- packages/manager/src/queries/account/users.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/manager/src/queries/account/users.ts b/packages/manager/src/queries/account/users.ts index ac819e4bde3..ae720f52cb7 100644 --- a/packages/manager/src/queries/account/users.ts +++ b/packages/manager/src/queries/account/users.ts @@ -15,6 +15,7 @@ import type { Filter, Grants, Params, + Profile, ResourcePage, User, } from '@linode/api-v4'; @@ -65,11 +66,20 @@ export const useUpdateUserMutation = (username: string) => { accountQueries.users._ctx.user(user.username).queryKey, user ); - // If the currently logged in user updates their user + + // If the currently logged in user updates their user, we need to update the profile + // query to reflect the latest data. if (username === profile?.username) { - queryClient.invalidateQueries({ - queryKey: profileQueries.profile().queryKey, - }); + queryClient.setQueryData( + profileQueries.profile().queryKey, + (oldProfile) => { + if (!oldProfile) { + return; + } + + return { ...oldProfile, ...user }; + } + ); } }, }); From 695b166c79042d73fb6d993a6b385cfa1e9be272 Mon Sep 17 00:00:00 2001 From: Banks Nussman Date: Mon, 16 Sep 2024 13:32:32 -0400 Subject: [PATCH 2/2] Added changeset: Flickering on the user profile page when updating the currently signed in user's username --- packages/manager/.changeset/pr-10947-fixed-1726507951785.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/manager/.changeset/pr-10947-fixed-1726507951785.md diff --git a/packages/manager/.changeset/pr-10947-fixed-1726507951785.md b/packages/manager/.changeset/pr-10947-fixed-1726507951785.md new file mode 100644 index 00000000000..8f9cc90912a --- /dev/null +++ b/packages/manager/.changeset/pr-10947-fixed-1726507951785.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Flickering on the user profile page when updating the currently signed in user's username ([#10947](https://github.com/linode/manager/pull/10947))