Skip to content
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

History state doc is confusing #279

Open
imsergiobernal opened this issue Jan 27, 2022 · 1 comment
Open

History state doc is confusing #279

imsergiobernal opened this issue Jan 27, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@imsergiobernal
Copy link

imsergiobernal commented Jan 27, 2022

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.

@davidkpiano davidkpiano added the documentation Improvements or additions to documentation label Jan 27, 2022
@kfern
Copy link

kfern commented Jan 30, 2022

Hi! A real world use case at https://www.youtube.com/watch?v=fT9p9CCSrn8&t=1260

@davidkpiano davidkpiano transferred this issue from statelyai/xstate Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants