Skip to content

[Setup Wizard] Refactor XState context management on transition #10660

@nucleogenesis

Description

@nucleogenesis

Overview

#10277 opened up a conversation regarding how we manage state between transitions in the Setup Wizard state machine (and potentially others).

The first pass at the SetupWizard machine works such that:

  • Each step only "commits" the update to the state when the user clicks "CONTINUE"
  • If the user clicks "BACK" the state is not resolved (with 1-2 exceptions)
  • Thus, each component needs to initialize its own internal state (ie, values of form elements) every time it is mounted and fall back to a default.

The suggestion in #10277 was to use the native XState history feature. This, however, presented us with a sort of inverse problem. Rather than the component the user goes back to reading the XState state for its initial value, we would have to manually pass the state to the component when we pop the history stack since going back on the history stack "undoes" the changes to state made based on the user's selections.

Another suggestion from @MisRob was to look into https://github.com/marcelkalveram/xstate-undoable

# Deliverables
- [ ] Research and prepare an agenda for a discussion around the potential solutions
- [ ] Lead a discussion with any interested parties to arrive at a decision on how we can revise and possibly standardize our use of XState
- [ ] Create an issue detailing what changes should happen to the SetupWizard

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions