Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/web/src/shell/first-run-tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ const STEPS: readonly Step[] = [
* been seen for this user, so it costs nothing on every later visit.
*/
export function FirstRunTour({ userId }: { readonly userId: string }) {
const [run] = useState(() => !hasSeenTour(userId));

if (!run) return null;
const [run, setRun] = useState(() => !hasSeenTour(userId));

// Dismissing has to unmount Joyride, not just remember the dismissal:
// a running Joyride keeps two portals appended to `document.body` and
// an overlay over the app, and those portal containers are managed
// outside React's tree.
function handleCallback(data: CallBackProps) {
// The tooltip's close (X) button fires action "close" without ever
// moving status to FINISHED or SKIPPED, so it has to be treated as a
Expand All @@ -76,9 +78,12 @@ export function FirstRunTour({ userId }: { readonly userId: string }) {
data.action === ACTIONS.CLOSE
) {
markTourSeen(userId);
setRun(false);
}
}

if (!run) return null;

return (
<Joyride
steps={STEPS as Step[]}
Expand Down
Loading