Skip to content

Commit 2fc5947

Browse files
committed
chore(react): fix profile updates
1 parent c08facf commit 2fc5947

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/react/src/utils/getUserProfile.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,36 @@ const getUserProfile = async ({baseUrl}): Promise<any> => {
8080
if (complexValue[subAttr.name] !== undefined) {
8181
const {subAttributes, ...attrWithoutSubAttrs} = attr;
8282

83+
// UPDATED PATH: prefix with schemaId except for core user schema
84+
const basePath =
85+
schemaId === 'urn:ietf:params:scim:schemas:core:2.0:User'
86+
? `${name}.${subAttr.name}`
87+
: `${schemaId}.${name}.${subAttr.name}`;
88+
8389
result.push({
8490
schemaId,
8591
...subAttr,
8692
value: complexValue[subAttr.name],
8793
parent: {
8894
...attrWithoutSubAttrs,
8995
},
90-
path: `${name}.${subAttr.name}`,
96+
path: basePath,
9197
});
9298
}
9399
}
94100
} else {
95101
const value = source[name];
96102
// Only include if value exists
103+
97104
if (value !== undefined) {
105+
// UPDATED PATH: prefix with schemaId except for core user schema
106+
const basePath = schemaId === 'urn:ietf:params:scim:schemas:core:2.0:User' ? name : `${schemaId}.${name}`;
107+
98108
result.push({
99109
schemaId,
100110
...attr,
101111
value,
102-
path: name,
112+
path: basePath,
103113
});
104114
}
105115
}

0 commit comments

Comments
 (0)