Kelin2025/effector-history

Serialization of internal stores

Opened this issue · 3 comments

Now any internal store of this library serialized in SSR-flow.

Shall we add { serialize: 'ignore' } to internal stores?

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

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.

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