Skip to content

Allow function/handler in the event definition #95

@kishorliv

Description

@kishorliv

I was wondering if we could achieve something like this:

search_state: {
    on: {
      GO_BACK: (previousState) => {
        if(previousState === 'initial_state'){
            return 'initial_state'
        }

        return "manual_search_state";
      },
    },
  }

Basically, i want to dynamically go to the new state based on certain conditions. But right now, the handler is not allowed in the definition, it just accepts string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions