mjstahl / stated

Simply put state management for your JavaScript application
https://www.npmjs.com/package/@mjstahl/stated
MIT License
4 stars 0 forks source link

actionless states cannot transition because the actions are not recognized as valid #12

Closed mjstahl closed 5 years ago

mjstahl commented 5 years ago
const routes = stated({
  initial: '/toggle/index.html',
  '/toggle/index.html': {
    value: 'toggleIndex'
  },
  '/hello': {
    value: 'hello'
  },
})

routes.to('/hello')

// Exception
// '/hello' does not exist as an action of '/toggle/index.html'

This is because with the change to support states that don't have paths, actions was modified to includes the names of the states.

This means that https://github.com/mjstahl/stated/blob/master/index.js#L75 will never be executed.