Open
Description
function trackProperties(
isImmutable: IsImmutableFunc,
ignorePaths: IgnorePaths = [],
obj: Record<string, any>,
path: string = '',
checkedObjects: Set<Record<string, any>> = new Set(),
) {
const tracked: Partial<TrackedProperty> = { value: obj }
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
checkedObjects.add(obj)
tracked.children = {}
for (const key in obj) {
const childPath = path ? path + '.' + key : key
if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
continue
}
tracked.children[key] = trackProperties(
isImmutable,
ignorePaths,
obj[key],
childPath,
)
}
}
return tracked as TrackedProperty
}
recursive call to trackProperties (line 57) is not passing down the checkedObjects argument.
It means all the circularity check you do in your code is totally bypass.
That's why immutable is not working with circular references
Metadata
Metadata
Assignees
Labels
No labels