Skip to content

Rule: prefer-serializable-value-in-store #91

@igorkamyshev

Description

@igorkamyshev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions