diff --git a/components/dashboard/package.json b/components/dashboard/package.json index 258b0a0667714c..8032c18108147c 100644 --- a/components/dashboard/package.json +++ b/components/dashboard/package.json @@ -29,6 +29,7 @@ "countries-list": "^2.6.1", "crypto-browserify": "3.12.0", "dayjs": "^1.11.5", + "deepmerge": "^4.2.2", "file-saver": "^2.0.5", "idb-keyval": "^6.2.0", "js-cookie": "^3.0.1", diff --git a/components/dashboard/src/data/current-user/update-mutation.ts b/components/dashboard/src/data/current-user/update-mutation.ts index 43b5ab798bc1ad..625f1da3b6c683 100644 --- a/components/dashboard/src/data/current-user/update-mutation.ts +++ b/components/dashboard/src/data/current-user/update-mutation.ts @@ -4,12 +4,13 @@ * See License.AGPL.txt in the project root for license information. */ -import { User as UserProtocol } from "@gitpod/gitpod-protocol"; +import { AdditionalUserData, User as UserProtocol } from "@gitpod/gitpod-protocol"; import { useMutation } from "@tanstack/react-query"; import { trackEvent } from "../../Analytics"; import { getGitpodService } from "../../service/service"; import { useAuthenticatedUser } from "./authenticated-user-query"; import { converter } from "../../service/public-api"; +import deepmerge from "deepmerge"; type UpdateCurrentUserArgs = Partial; @@ -20,10 +21,10 @@ export const useUpdateCurrentUserMutation = () => { const update: UpdateCurrentUserArgs = { id: current.id, fullName: partialUser.fullName || current.fullName, - additionalData: { - ...current.additionalData, - ...partialUser.additionalData, - }, + additionalData: deepmerge( + current.additionalData || {}, + partialUser.additionalData || {}, + ), }; const user = await getGitpodService().server.updateLoggedInUser(update); return converter.toUser(user);