eslint-plugin icon indicating copy to clipboard operation
eslint-plugin copied to clipboard

Rule: `prefer-serializable-value-in-store`

Open igorkamyshev opened this issue 3 years ago • 1 comments

This code

const $data = createStore(new Date())
const setData = createEvent<Date>()

const scope1 = fork()

await allSettled(setData, { scope: scope1, params: new Date('2020-01-01') })

const json = JSON.stringify(serialize(scope))

const scope2 = fork()

hydrate(scope2, { values: JSON.parse(json) })

will produce error because Date will be serialized to ISO-format, but won't be deserialized back.

We can warn user about it

igorkamyshev avatar Feb 15 '22 15:02 igorkamyshev

cc @alatielle

igorkamyshev avatar Feb 15 '22 15:02 igorkamyshev