History state doc is confusing
imsergiobernal opened this issue · 1 comments
Description
https://xstate.js.org/docs/guides/history.html#history-state-configuration
-
First of all, it would be nice if there could be some kind of comparative example between
shallow
anddeep
types. -
Also, some kind of fan type introduction to the reader. There are a lot of fan types.
But is this one? (infinite conmutator)
Or this one? (fixed positions, remembers the position even when plug-unplug from electric cable)
has it an aditional independent power button, like this one?
feel the difference between the latest two as well. Physical state vs in-memory state.
-
Which kind on event is
HIGH_POWER
in real life and why does it ask for history? HIGHEST POWER is third, I don't understand why whould you ask for history. -
Why on a
POWER
event it would target to 'fanOff'? As a reader I would expect to go 'fanOn'
fanOn: {
....
on: {
POWER: { target: 'fanOff' }
}
}
- If you try to paste the full example on Visualizer, you will get an error
Type '{ type: "history"; target: string; }' is not assignable to type 'StateNodeConfig<unknown, any, AnyEventObject, ActionObject<unknown, AnyEventObject>>'.
Object literal may only specify known properties, and 'target' does not exist in type 'StateNodeConfig<unknown, any, AnyEventObject, ActionObject<unknown, AnyEventObject>>'.(2322)
Thanks
I'm sorry if my English sounds very strict or even not understandable. I don't speak english but I try my best. Thanks for your comprehension.
Hi! A real world use case at https://www.youtube.com/watch?v=fT9p9CCSrn8&t=1260