devrnt / react-use-wizard

🧙 A React wizard (stepper) builder without the hassle, powered by hooks.

Home Page:https://devrnt.github.io/react-use-wizard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Last step does not execute `handleStep`.

MichielDeMey opened this issue · comments

In our use case, the last step of the wizard is often the step where we have to save our data by sending an API call to our backend.

My initial thought was to use the handleStep property from the useWizard hook, so we can also enjoy the isLoading boolean and error handling.

Unfortunately, it looks like the last step never executes the handleStep function forcing us to circumvent the hook and implement our own function for executing an async function in the last step.

(And also implementing a second isLoading boolean)

Is this a known limitation of the library or did we stumble upon a bug?

I understand your use case, but at the moment this is expected behaviour. nextStep will only be invoked when the wizard detects there is "a next step" (aka a child)

I'll close this, feel free to re-open if you've any more questions