Skip to content

Commit 4027ce4

Browse files
committed
try fix useUpdateCurrentUserMutation
1 parent 0881a30 commit 4027ce4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

components/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"countries-list": "^2.6.1",
3030
"crypto-browserify": "3.12.0",
3131
"dayjs": "^1.11.5",
32+
"deepmerge": "^4.2.2",
3233
"file-saver": "^2.0.5",
3334
"idb-keyval": "^6.2.0",
3435
"js-cookie": "^3.0.1",

components/dashboard/src/data/current-user/update-mutation.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* See License.AGPL.txt in the project root for license information.
55
*/
66

7-
import { User as UserProtocol } from "@gitpod/gitpod-protocol";
7+
import { AdditionalUserData, User as UserProtocol } from "@gitpod/gitpod-protocol";
88
import { useMutation } from "@tanstack/react-query";
99
import { trackEvent } from "../../Analytics";
1010
import { getGitpodService } from "../../service/service";
1111
import { useAuthenticatedUser } from "./authenticated-user-query";
1212
import { converter } from "../../service/public-api";
13+
import deepmerge from "deepmerge";
1314

1415
type UpdateCurrentUserArgs = Partial<UserProtocol>;
1516

@@ -20,10 +21,10 @@ export const useUpdateCurrentUserMutation = () => {
2021
const update: UpdateCurrentUserArgs = {
2122
id: current.id,
2223
fullName: partialUser.fullName || current.fullName,
23-
additionalData: {
24-
...current.additionalData,
25-
...partialUser.additionalData,
26-
},
24+
additionalData: deepmerge<AdditionalUserData>(
25+
current.additionalData || {},
26+
partialUser.additionalData || {},
27+
),
2728
};
2829
const user = await getGitpodService().server.updateLoggedInUser(update);
2930
return converter.toUser(user);

0 commit comments

Comments
 (0)