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(demo-mode): multi-tour context #88781

Merged
merged 23 commits into from
Apr 11, 2025
Merged

feat(demo-mode): multi-tour context #88781

merged 23 commits into from
Apr 11, 2025

Conversation

obostjancic
Copy link
Member

@obostjancic obostjancic commented Apr 4, 2025

Closes TET-81

Introduces a DemoToursContext that manages multiple demo tours (Sidebar, Issues, Releases, Performance) with shared state management. Each tour maintains its own progress while using common components described in storybook for state persistence and step navigation.

Actual tours will be ported over to this in the followup PRs

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 4, 2025
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
static/app/utils/demoMode/guides.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #88781      +/-   ##
==========================================
+ Coverage   87.69%   87.76%   +0.06%     
==========================================
  Files       10089    10031      -58     
  Lines      570583   567241    -3342     
  Branches    22444    22261     -183     
==========================================
- Hits       500396   497820    -2576     
+ Misses      69776    68998     -778     
- Partials      411      423      +12     

@obostjancic obostjancic changed the title feat(demo-mode): demo tours feat(demo-mode): multi-tour context Apr 7, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@obostjancic obostjancic requested a review from a team April 8, 2025 12:40
@obostjancic obostjancic marked this pull request as ready for review April 8, 2025 12:40
Comment on lines +186 to +197
mockSetState = jest.fn(
(stateOrUpdater: MockToursState | ((prev: MockToursState) => MockToursState)) => {
if (typeof stateOrUpdater === 'function') {
mockState = stateOrUpdater(mockState);
} else {
mockState = stateOrUpdater;
}
return mockState;
}
);

mockUseLocalStorageState.mockImplementation(() => [mockState, mockSetState]);
Copy link
Member

@scttcper scttcper Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like we could simplify this. i think localstorage is already mocked

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a shot but wasn't able to get it to easily do what we need here since useLocalStorageState uses useState as its primary state storage and also keeps localStorage in sync with a micro task. So we would have to mock both :/

ryan953
ryan953 previously requested changes Apr 8, 2025
@ryan953 ryan953 dismissed their stale review April 9, 2025 16:36

The tests are more hook specific now, so the main problem i had is fixed. But it's a big change so the review kind starts over.

@obostjancic obostjancic merged commit c16f5b6 into master Apr 11, 2025
42 checks passed
@obostjancic obostjancic deleted the ogi/feat/demo-tours branch April 11, 2025 07:20
Copy link

sentry-io bot commented Apr 11, 2025

Suspect Issues

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

  • ‼️ Error: Must be used within a TourContextProvider useDemoTours(demoTours.tsx) View Issue
  • ‼️ Error: Must be used within a TourContextProvider useDemoTours(demoTours.tsx) 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.

4 participants