Skip to content

[BUG] Сustom store serializer is not working during initial client scope hydration #35

@domosedov

Description

@domosedov

Clone Repo

gh repo clone domosedov/effector-next-bug
cd effector-next-bug && pnpm i && pnpm dev

При начальной гидратации клиентского скоупа кастомный сериализатор стора не вызывается

export const $homeDate = createStore<Date | null>(null, {
  serialize: {
    read: (dateStringOrNull) =>
      typeof dateStringOrNull === "string" ? new Date(dateStringOrNull) : null,
    write: (dateOrNull) => (dateOrNull ? dateOrNull.toISOString() : null),
  },
});

Поэтому на странице вместо объекта Date получаем string

При переходе на другую страницу, а потом обратно сеарилазция отрабатывает корректно

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions