File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
components/dashboard/src/data/current-user Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { getGitpodService } from "../../service/service";
11
11
import { useCurrentUser } from "../../user-context" ;
12
12
import { converter } from "../../service/public-api" ;
13
13
import deepmerge from "deepmerge" ;
14
+ import uniq from "lodash/uniq" ;
14
15
15
16
type UpdateCurrentUserArgs = Partial < UserProtocol > ;
16
17
@@ -31,6 +32,15 @@ export const useUpdateCurrentUserMutation = () => {
31
32
partialUser . additionalData || { } ,
32
33
) ,
33
34
} ;
35
+ // deepmerge will try append array, so once data is defined, ignore previous value
36
+ if ( partialUser . additionalData ?. profile ?. explorationReasons ) {
37
+ update . additionalData ! . profile ! . explorationReasons = uniq (
38
+ partialUser . additionalData . profile . explorationReasons ,
39
+ ) ;
40
+ }
41
+ if ( partialUser . additionalData ?. profile ?. signupGoals ) {
42
+ update . additionalData ! . profile ! . signupGoals = uniq ( partialUser . additionalData . profile . signupGoals ) ;
43
+ }
34
44
const user = await getGitpodService ( ) . server . updateLoggedInUser ( update ) ;
35
45
return converter . toUser ( user ) ;
36
46
} ,
You can’t perform that action at this time.
0 commit comments