Skip to content

Semantic meaning of state.value #1805

Answered by davidkpiano
dimsuz asked this question in Q&A
Discussion options

You must be logged in to vote

I see that it is based purely on schema keys, not state IDs. Why?

Because keys identify the hierarchical path to a state node. This is the difference between representing a state like this:

{
  active: {
    brightness: 'bright',
    mode: 'light'
  }
}

Rather than this:

[
  'active',
  'active.brightness',
  'active.brightness.bright',
  'active.mode',
  'active.mode.light'
]

Or with some unique IDs:

// examples of IDs
[
  'active',
  'brightness',
  'bright',
  'mode',
  'lightMode'
]

It's more concise and useful to represent a state value (which represents the finite state) as its hierarchical representation, rather than just as a collection of IDs.

Couldn't state id (or a set of st…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dimsuz
Comment options

Answer selected by dimsuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants