Skip to content

Commit 385f45f

Browse files
introduced a fix which would allow us to add fields that are empty objects into the masks despite being leaves: this means that specifically NULLs are to be handled for clearing
1 parent 4f7d7bf commit 385f45f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/utils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ export function recursiveFieldMaskSearch(data: Record<string, any>): string[] {
8181
const fieldKey = toSnakeCase(key);
8282
const value = data[key];
8383
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
84-
const children = recursiveFieldMaskSearch(value);
85-
for (const child of children) {
86-
paths.push(`${fieldKey}.${child}`);
84+
if (Object.keys(value).length === 0) {
85+
paths.push(fieldKey);
86+
} else {
87+
const children = recursiveFieldMaskSearch(value);
88+
for (const child of children) {
89+
paths.push(`${fieldKey}.${child}`);
90+
}
8791
}
8892
continue;
8993
}

0 commit comments

Comments
 (0)