Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(useStepper): new function #1679
feat(useStepper): new function #1679
Changes from 5 commits
0d07c59
2b7eeeb
c0c2437
10c39b2
a610322
f55a1da
febeb2c
4cd4be2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have this check on usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I don't understand. On usage of what? To clarify,
goTo
allows to jump to a step without any check, whilebackTo
allows to go back to a previous step if it has been completed.I needed this feature when trying to allow to click on the step names, but only when it has been done, as you can see on the demo:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would feel a bit weird to me that:
In your case, the
disabled
already serve as a guard for it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But
backTo
can be called from somewhere else than a button and in that case,disabled
wouldn't guard it. Also a button's attribute is easier to tamper with than the code directly.If you think it's weird maybe you just need to use
goTo
in such a situation? I designedbackTo
with the guard idea in mind, and if it's removed, the function becomes useless in favor ofgoTo
. But in every wizard I made in my recent apps, this specific function was useful.Maybe we can rename
backTo
with a name that would be less confusing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, what I mean is the guard should be done on userland when calling
goTo
. Since there is only one line of addition inbackTo
, the trade-off of saving one line but introducing an additional abstraction layer that users/readers need to understand is a bit less worthy to me. I'd suggest we remove it, and let users define it when needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand - I removed it.
That being said, I still think this function is very useful, since I used it in all my wizards without exception - and I updated the demo code to show you how an userland
backTo
would look like, I think it's not the best DX-wise.But I respect your decision if you still think it's not needed!