mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-23 10:47:54 +00:00
Add function to remove circular references and use it in SpaceService
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export function removeCircularReferences() {
|
||||
const seen = new WeakSet();
|
||||
return (key: string, value: any) => {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (seen.has(value)) {
|
||||
return undefined; // Skip circular reference
|
||||
}
|
||||
seen.add(value);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user