-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hi guys,
I'm using redux-persist
which uses remotedev-serialize
which uses your package for (de)serialization of the Immutable js
app state.
When several properties in the object tree have the same values then jsan
tries to reuse first entry of the value using references to it in other places.
For example:
obj = {
prop1: 'sample value',
prop2: {
prop3: 'sample value'
}
}
after serialization will be
{ "prop1": "sample value", "prop2": { "prop3": "$.prop1" }}
But with Immutable js
during the serialization remotedev-serialize
with help of jsan
converts immutable js structures into it's own representation and serializes it.
So the references for the same values are built over the converted structure instead of the original Immutable js
structures.
And during the deserialization jsan
first transforms its own representation to the original Immutable js
structure and only after that trying to resolve references for the same values but fails and always returns undefined
cuz such references for its own representation can't be resolved on the original Immutable js
structure.
Lines 43 to 50 in a37187a
if (arguments.length === 1) { | |
parsed = JSON.parse(text); | |
} else { | |
parsed = JSON.parse(text, reviver); | |
} | |
if (needsRetrocycle) { | |
parsed = cycle.retrocycle(parsed); | |
} |