Skip to content

Conversation

@emorissettegregoire
Copy link
Contributor

This PR introduces support for before_state, after_state, and around_state callbacks within the FlowManager.

These callbacks can now be defined in the flow DSL and are automatically invoked during state transitions:

  • before_state runs before the state block,
  • after_state runs after the state block, and
  • around_state wraps the state block, enabling advanced behaviors like pre- and post-processing.

Additionally, the flow structure has been updated to support nested states, with callbacks as a top-level key.
The structure now looks like this:

@flows = {
  hello: {
    states: {
      say_hello: { block: ..., options: ... },
      ...
    },
    callbacks: { before_state: [ ], around_state: [ ], after_state: [ ] }
  }
}

@matthewblack matthewblack merged commit e679f06 into 3.0-mountable Jun 5, 2025
@matthewblack matthewblack deleted the callback-helpers branch June 5, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants