question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restrict state transitions according to graph

See original GitHub issue

Should switch reducers based on the current state in order to ensure that the program can’t enter bad states.

  • For each state, build a reducer that only responds to transitions listed for that state in the state graph
  • Create a parent/meta reducer that switches the invoked child reducer based on the current state

Sample state graph:

const fetchingStates = [
  ['initialize', 'idle',
    ['fetch', 'fetching',
      ['cancel', 'idle'],
      ['report error', 'error',
        ['handle error', 'idle']
      ],
      ['report success', 'success',
        ['handle success', 'idle']
      ]
    ]
  ]
];

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dash-commented, Feb 4, 2017

Okay, I think I get it completely. Let me think on it, and maybe I’ll attack it tomorrow. Thanks for your time and help understanding this!

0reactions
ericelliottcommented, Feb 13, 2017

Published as v1.0.3. Thanks @dash- !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transition Graph - an overview | ScienceDirect Topics
Figure 3 is an example of contact state transition graph, (a) shows models of an object and environment. From these models, we can...
Read more >
LEARNING GRAPHICAL STATE TRANSITIONS - OpenReview
and can either produce a final graph representing its current state, ... Each unit uses a reset gate r and an update gate...
Read more >
Construct and Run a Stateflow Chart - MATLAB & Simulink
Build state transition diagrams in the Stateflow graphical programming editor. ... a Stateflow chart that you can simulate as a block in a...
Read more >
State Chart XML (SCXML): State Machine Notation for ... - W3C
When a transition is taken, the state machine will exit all active states that are proper descendants of the LCCA, starting with the...
Read more >
Finite-state machine - Wikipedia
The FSM can change from one state to another in response to some inputs; the change from one state to another is called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found