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

feat(tour): Add callbacks for onStartTour and onEndTour #87810

Merged
merged 4 commits into from
Mar 25, 2025

Conversation

malwilley
Copy link
Member

@malwilley malwilley commented Mar 24, 2025

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() and onEndTour() 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 and endTour instead of the raw dispatch.

@malwilley malwilley requested a review from leeandher March 24, 2025 22:10
@malwilley malwilley requested a review from a team as a code owner March 24, 2025 22:10
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 24, 2025
Copy link
Member

@leeandher leeandher left a 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!! ❤️

Comment on lines +199 to +201
const nextStep = useCallback(() => {
dispatch({type: 'NEXT_STEP'});
}, []);
Copy link
Member

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.

@malwilley malwilley merged commit 3352796 into master Mar 25, 2025
40 checks passed
@malwilley malwilley deleted the malwilley/feat/tour-callbacks branch March 25, 2025 17:26
Copy link

sentry-io bot commented Mar 26, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Cannot read properties of undefined (reading '__ec_inner_46') /issues/:groupId/ View Issue
  • ‼️ SyntaxError: Invalid or unexpected token /issues/:groupId/ View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants