-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v5] Remove state.history
#2882
Conversation
🦋 Changeset detectedLatest commit: 0096d9f The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodeSee Review Map:Review in an interactive map View more CodeSee Maps Legend |
"count": 1, | ||
"currentWeight": 1, | ||
"relativeWeight": 1, | ||
"count": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it's somewhat surprising that this has been affected anyhow by this PR. Do you know why that is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard this, I want to rework @xstate/analytics
(very old project) before releasing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this has been affected is because it was using state.history
, but now we have to use something different (which I added).
Renaming would have the same downsides as the current solution. I think it's safe to remove this completely and to figure out a better solution in the future IF we find any compelling use cases to provide access to this. |
This PR removes the
history
property from theState
object, for these reasons:state.history
breaks immutability from states since every penultimatestate.history
is deleted to prevent memory leaksstate.history
is not used for the statechart history mechanism (state.historyValue
is, and that is staying)I'm still on the fence whether this should be completely removed or just renamed to
state.previous
(cc. @Andarist) - I'd like to get an idea of how useful accessing the previous state is from within the machine, which is the most compelling use-case to keep this feature.Note: This does not remove the history mechanism from XState machines.