Serialization of internal stores
Opened this issue · 3 comments
igorkamyshev commented
Now any internal store of this library serialized in SSR-flow.
Shall we add { serialize: 'ignore' }
to internal stores?
Kelin2025 commented
I think not. Can't come up with use case for using history on server side, but it can cause state inconsistency if someone will do it
igorkamyshev commented
Imagine the situation
const $data = createStore(new Date()) // or other non-json structure
const history = createHistory({
source: {
data: $data,
},
maxLength: 20
})
After serialization and deserialization cycle, client will find invalid state in history
and after undo
-call it will propagate to original store.
Kelin2025 commented
Got it. But I think it'd better to pass serialize
as an option for createHistory
so users can decide whether they need it or not