-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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(tour): Add callbacks for onStartTour and onEndTour #87810
Conversation
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 really appreciate these PRs @malwilley I think the quality of life improvements and developer-friendliness is wayy better this way!! ❤️
const nextStep = useCallback(() => { | ||
dispatch({type: 'NEXT_STEP'}); | ||
}, []); |
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.
Looks good! Just FYI, if the NEXT_STEP
action is called when there are no more steps, it will have the same result as the END_TOUR
action. If that's the case, I'm wondering if we'd expect callbacks.onEndTour()
to be invoked.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Depends on #87805
Look at 119f725 for the actual diff that's not reliant on the previous PR
The purpose for these changes is to add
onStartTour()
andonEndTour()
callbacks. I want this so that I can show a reminder tooltip. I could rely on state changes, but allows users to avoid a useEffect.I implemented this by wrapping the dispatch calls into functions which also call the callback. This should make the component API a bit clearer, since it returns functions like
startTour
andendTour
instead of the rawdispatch
.