Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeStepChange in multi step plugin is fired without step change #1343

Closed
dulnan opened this issue May 8, 2024 · 2 comments
Closed

beforeStepChange in multi step plugin is fired without step change #1343

dulnan opened this issue May 8, 2024 · 2 comments
Assignees
Labels
🐛 bug Verified bug by team 🪄 enhancement New feature or request 🟡 priority-2 2. Medium priority issue 🚀 release-ready Feature or fix is complete and on an upcoming release branch

Comments

@dulnan
Copy link
Sponsor

dulnan commented May 8, 2024

Reproduction

https://formkit.link/1ba7c9017f2a41c01965c6fb86dc3d7e

Describe the bug

When using the beforeStepChange event on a multi step form in combination with :allow-incomplete="false", the event is fired even when the step did not actually change. Maybe this is by design, in which case there should probably be a "afterStepChange" event, so that it's possible to keep track of the current visible step. In my case I'd like to add this information to the URL so that a browser refresh shows the same step again.

Environment

• Version 1.6.2

@dulnan dulnan added ⛑ Needs triage The issue has not yet been examined by the FormKit team. 🐛 bug-report Bug is reported, but not verified by team labels May 8, 2024
@andrew-boyd andrew-boyd added 🐛 bug Verified bug by team 🪄 enhancement New feature or request 🟡 priority-2 2. Medium priority issue and removed 🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team. labels May 13, 2024
@andrew-boyd
Copy link
Member

This is a good catch — I think an adding an afterStepChange event is probably the correct move here.

@andrew-boyd
Copy link
Member

Upon inspecting the code, I feel that the beforeStepChange firing when the step is not actually going to change is a bug, so I have corrected that behavior. beforeStepChange should now only file when the step actually will change and that behavior can be depended on to do what you're trying to do in your project.

@andrew-boyd andrew-boyd added the 🚀 release-ready Feature or fix is complete and on an upcoming release branch label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Verified bug by team 🪄 enhancement New feature or request 🟡 priority-2 2. Medium priority issue 🚀 release-ready Feature or fix is complete and on an upcoming release branch
Projects
None yet
Development

No branches or pull requests

2 participants