-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
refactorAn improvement to the implementationAn improvement to the implementation
Description
Based on this comment, we could move a lot of the MQT snapshotting behaviour into the types themselves. That way we could avoid hardcoding a ton of logic in a single function, like how we deal with snapshotting references in an array/map:
mobx-quick-tree/src/snapshot.ts
Lines 26 to 32 in 918bddd
const type = getType(value) as MapType<IAnyType>; | |
const childrenAreReferences = isReferenceType(type.childrenType); | |
return Object.fromEntries( | |
Array.from(value.entries()).map(([k, v]) => { | |
return [k, childrenAreReferences ? v[$identifier] : snapshot(v)]; | |
}) |
Metadata
Metadata
Assignees
Labels
refactorAn improvement to the implementationAn improvement to the implementation