statelyai/docs

History state doc is confusing

imsergiobernal opened this issue · 1 comments

Description
https://xstate.js.org/docs/guides/history.html#history-state-configuration

  1. First of all, it would be nice if there could be some kind of comparative example between shallow and deep types.

  2. Also, some kind of fan type introduction to the reader. There are a lot of fan types.

This one is obviusly not
image

But is this one? (infinite conmutator)
image

Or this one? (fixed positions, remembers the position even when plug-unplug from electric cable)
image

has it an aditional independent power button, like this one?

image

feel the difference between the latest two as well. Physical state vs in-memory state.

  1. 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.

  2. Why on a POWER event it would target to 'fanOff'? As a reader I would expect to go 'fanOn'

    fanOn: {
      ....
      on: {
        POWER: { target: 'fanOff' }
      }
    }
  1. 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.

kfern commented