Replies: 1 comment 4 replies
-
I'm moving this to a discussion, as it is an enhancement to discuss rather than a bug, given that the same kind of problem will occur with any state restoration in general (with or without XState). We can add basic validation that the state value is compatible with the state machine. The better long-term solution is to include some sort of "hash" of the machine to verify that the provenance of the state is from the machine that's attempting to restore that state. I'm wondering if this should throw or warn, though 🤔 Warning gives the false sense that the state is "okay". Maybe there should be a |
Beta Was this translation helpful? Give feedback.
-
Description
When using a persisted state loaded from local storage to hydrate the state machine, and schema changes are introduced to the state machine, such as a renaming of a certain node state, the state machine throws an error.
Expected result
I would expect the state machine to ignore the persisted state when provided, and log a warning instead.
Actual result
My react application throws an error and breaks the frontend. And the only way to recover is by clearing the local storage.
Reproduction
None
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions