Skip to content

onPreventChange() callback not firing #115

Open
@jaimefps

Description

@jaimefps

Describe the bug

onPreventChange() callback not firing when onBeforeChange() returns a Promise that outputs false.
Also seeing what I suspect is the incorrect value passed to onPreventChange()

To Reproduce

// first issue example

  <Steps
      // some large amount of steps:
      steps={[{..}, {..}, {..}]}
      
      // async attempt to skip step 1
      onBeforeChange={async (step) => {
            if (step == 1) return 2
      })
      
      // try to detect the skip:
      onPreventChange={(step) => {
        // this never logs
        console.log({ skipped: step })
      }}
    />

// second issue example

  <Steps
      // some large amount of steps:
      steps={[{..}, {..}, {..}]}
      
      // attempt to skip step 1
      onBeforeChange={(step) => {
            if (step == 1) return 2
      })
      
      // try to detect the skip:
      onPreventChange={(step) => {
        // logs 0, instead of 1
        console.log({ skipped: step }) 
      }}
    />

Expected behavior

I'd expect that if the returned Promise from onBeforeChange() itself outputs a false, then we still get to fire onPreventChange()

How often does this bug happen?

Every time

System Info

macOS 14.5 (23F79)
Chromium browsers

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions