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.
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.
Disregard this, I want to rework @xstate/analytics (very old project) before releasing it.
There was a problem hiding this comment.
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
historyproperty from theStateobject, for these reasons:state.historybreaks immutability from states since every penultimatestate.historyis deleted to prevent memory leaksstate.historyis not used for the statechart history mechanism (state.historyValueis, 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.