Skip to content

Conversation

@priscilawebdev
Copy link
Member

@priscilawebdev priscilawebdev commented Mar 27, 2025

This PR does the following:

  • Fixes the weird reordering animation in Quick Start by using Promise.all to ensure all promises are resolved before updating the Organization Store.

And yes, it does a bit more than just that:

  • Updates the action function to use the React Query mutation hook.
    • As a result, several tests and files had to be updated to reflect these changes.
  • When the demo is active, the updateDemoWalkthroughTask function can now be used directly, eliminating the need for the updateOnboardingTask function - so, it got removed.

Before

Screen.Recording.2025-03-26.at.14.14.56.mov

After

Screen.Recording.2025-03-27.at.14.18.14.mov

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

codecov bot commented Mar 27, 2025

❌ 20 Tests Failed:

Tests completed Failed Passed Skipped
10030 20 10010 11
View the top 3 failed test(s) by shortest run time
Sidebar > Performance Onboarding Checklist checklist feature enabled > navigate to performance page > project with onboarding support
Stack Traces | 0.01s run time
TypeError: Cannot read properties of undefined (reading 'includes')
    at isActiveSuperuser (.../app/utils/isActiveSuperuser.tsx:29:32)
    at showSuperuserWarning (.../components/sidebar/index.tsx:88:53)
    at Sidebar (.../components/sidebar/index.tsx:396:24)
    at Object.react-stack-bottom-frame (.../react-dom/cjs/react-dom-client.development.js:22428:20)
    at renderWithHooks (.../react-dom/cjs/react-dom-client.development.js:5757:22)
    at updateFunctionComponent (.../react-dom/cjs/react-dom-client.development.js:8018:19)
    at beginWork (.../react-dom/cjs/react-dom-client.development.js:9683:18)
    at runWithFiberInDEV (.../react-dom/cjs/react-dom-client.development.js:543:16)
    at performUnitOfWork (.../react-dom/cjs/react-dom-client.development.js:15052:22)
    at workLoopSync (.../react-dom/cjs/react-dom-client.development.js:14870:41)
    at renderRootSync (.../react-dom/cjs/react-dom-client.development.js:14850:11)
    at performWorkOnRoot (.../react-dom/cjs/react-dom-client.development.js:14384:44)
    at performWorkOnRootViaSchedulerTask (.../react-dom/cjs/react-dom-client.development.js:15931:7)
    at flushActQueue (.../react/cjs/react.development.js:862:34)
    at Object.<anonymous>.process.env.NODE_ENV.exports.act (.../react/cjs/react.development.js:1151:10)
    at .../sentry/sentry/node_modules/@.../react/dist/act-compat.js:47:25
    at renderRoot (.../sentry/sentry/node_modules/@.../react/dist/pure.js:188:26)
    at Object.render (.../sentry/sentry/node_modules/@.../react/dist/pure.js:287:10)
    at render (.../js/sentry-test/reactTestingLibrary.tsx:272:28)
    at renderSidebar (.../components/performanceOnboarding/sidebar.spec.tsx:50:66)
    at Object.<anonymous> (.../components/performanceOnboarding/sidebar.spec.tsx:145:5)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at runNextTicks (node:internal/process/task_queues:65:5)
    at listOnTimeout (node:internal/timers:555:9)
    at processTimers (node:internal/timers:529:7)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)
Sidebar SidebarPanel can show Incidents in Sidebar Panel
Stack Traces | 0.01s run time
TypeError: Cannot read properties of undefined (reading 'includes')
    at isActiveSuperuser (.../app/utils/isActiveSuperuser.tsx:29:32)
    at showSuperuserWarning (.../components/sidebar/index.tsx:88:53)
    at Sidebar (.../components/sidebar/index.tsx:396:24)
    at Object.react-stack-bottom-frame (.../react-dom/cjs/react-dom-client.development.js:22428:20)
    at renderWithHooks (.../react-dom/cjs/react-dom-client.development.js:5757:22)
    at updateFunctionComponent (.../react-dom/cjs/react-dom-client.development.js:8018:19)
    at beginWork (.../react-dom/cjs/react-dom-client.development.js:9683:18)
    at runWithFiberInDEV (.../react-dom/cjs/react-dom-client.development.js:543:16)
    at performUnitOfWork (.../react-dom/cjs/react-dom-client.development.js:15052:22)
    at workLoopSync (.../react-dom/cjs/react-dom-client.development.js:14870:41)
    at renderRootSync (.../react-dom/cjs/react-dom-client.development.js:14850:11)
    at performWorkOnRoot (.../react-dom/cjs/react-dom-client.development.js:14384:44)
    at performWorkOnRootViaSchedulerTask (.../react-dom/cjs/react-dom-client.development.js:15931:7)
    at flushActQueue (.../react/cjs/react.development.js:862:34)
    at Object.<anonymous>.process.env.NODE_ENV.exports.act (.../react/cjs/react.development.js:1151:10)
    at .../sentry/sentry/node_modules/@.../react/dist/act-compat.js:47:25
    at renderRoot (.../sentry/sentry/node_modules/@.../react/dist/pure.js:188:26)
    at Object.render (.../sentry/sentry/node_modules/@.../react/dist/pure.js:287:10)
    at render (.../js/sentry-test/reactTestingLibrary.tsx:272:28)
    at renderSidebar (.../components/sidebar/index.spec.tsx:57:41)
    at Object.<anonymous> (.../components/sidebar/index.spec.tsx:282:7)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at runNextTicks (node:internal/process/task_queues:65:5)
    at listOnTimeout (node:internal/timers:555:9)
    at processTimers (node:internal/timers:529:7)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)
Sidebar can toggle collapsed state
Stack Traces | 0.01s run time
TypeError: Cannot read properties of undefined (reading 'includes')
    at isActiveSuperuser (.../app/utils/isActiveSuperuser.tsx:29:32)
    at showSuperuserWarning (.../components/sidebar/index.tsx:88:53)
    at Sidebar (.../components/sidebar/index.tsx:396:24)
    at Object.react-stack-bottom-frame (.../react-dom/cjs/react-dom-client.development.js:22428:20)
    at renderWithHooks (.../react-dom/cjs/react-dom-client.development.js:5757:22)
    at updateFunctionComponent (.../react-dom/cjs/react-dom-client.development.js:8018:19)
    at beginWork (.../react-dom/cjs/react-dom-client.development.js:9683:18)
    at runWithFiberInDEV (.../react-dom/cjs/react-dom-client.development.js:543:16)
    at performUnitOfWork (.../react-dom/cjs/react-dom-client.development.js:15052:22)
    at workLoopSync (.../react-dom/cjs/react-dom-client.development.js:14870:41)
    at renderRootSync (.../react-dom/cjs/react-dom-client.development.js:14850:11)
    at performWorkOnRoot (.../react-dom/cjs/react-dom-client.development.js:14384:44)
    at performWorkOnRootViaSchedulerTask (.../react-dom/cjs/react-dom-client.development.js:15931:7)
    at flushActQueue (.../react/cjs/react.development.js:862:34)
    at Object.<anonymous>.process.env.NODE_ENV.exports.act (.../react/cjs/react.development.js:1151:10)
    at .../sentry/sentry/node_modules/@.../react/dist/act-compat.js:47:25
    at renderRoot (.../sentry/sentry/node_modules/@.../react/dist/pure.js:188:26)
    at Object.render (.../sentry/sentry/node_modules/@.../react/dist/pure.js:287:10)
    at render (.../js/sentry-test/reactTestingLibrary.tsx:272:28)
    at renderSidebar (.../components/sidebar/index.spec.tsx:57:41)
    at Object.<anonymous> (.../components/sidebar/index.spec.tsx:290:5)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at runNextTicks (node:internal/process/task_queues:65:5)
    at listOnTimeout (node:internal/timers:555:9)
    at processTimers (node:internal/timers:529:7)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Comment on lines -14 to -38
describe('updateOnboardingTask', function () {
it('Adds the task to the organization when task does not exists', async function () {
const detailedOrg = OrganizationFixture();

// User is not passed into the update request
const testTask = {
task: OnboardingTaskKey.FIRST_PROJECT,
status: 'complete',
} as const;

const mockUpdate = MockApiClient.addMockResponse({
url: `/organizations/${detailedOrg.slug}/onboarding-tasks/`,
method: 'POST',
body: testTask,
});

updateOnboardingTask(api, detailedOrg, testTask);
await tick();

expect(mockUpdate).toHaveBeenCalled();

expect(OrganizationStore.onUpdate).toHaveBeenCalledWith({
onboardingTasks: [{...testTask, user}],
});
});
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 don't see why we would want to do that, and I believe it is related to the sandbox. However, since the sandbox now uses its own function, we can remove this extra code. Can you please confirm this, @obostjancic ?

Copy link
Member

Choose a reason for hiding this comment

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

yep, seems good to go

Comment on lines +15 to 24
describe('useUpdateOnboardingTasks', function () {
it('Updates existing onboarding tasks', async function () {
const organization = OrganizationFixture({
onboardingTasks: [
{
task: OnboardingTaskKey.FIRST_EVENT,
status: 'pending',
},
],
});
Copy link
Member Author

Choose a reason for hiding this comment

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

updated this test, so it works with a hook

{
task: OnboardingTaskKey.FIRST_PROJECT,
status: 'complete',
user: UserFixture(),
Copy link
Member Author

Choose a reason for hiding this comment

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

we no longer display a user face in the quick start. This can be removed


jest.unmock('sentry/utils/recreateRoute');
jest.mock('sentry/actionCreators/indicator');
jest.mock('sentry/actionCreators/onboardingTasks');
Copy link
Member Author

@priscilawebdev priscilawebdev Mar 27, 2025

Choose a reason for hiding this comment

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

This is probably here by mistake.

completionSeen?: string | boolean;
data?: {[key: string]: string};
dateCompleted?: string;
user?: AvatarUser | null;
Copy link
Member Author

Choose a reason for hiding this comment

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

this is not longer used in the quick start

);
expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});

expect(mockUpdateOnboardingTasks).toHaveBeenCalledTimes(1);
Copy link
Member Author

Choose a reason for hiding this comment

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

this make sure that when an issue alert is created and the demo mode is not active, we mark the alert rule task as complete

Comment on lines +180 to +182
if (isDemoModeActive()) {
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

we missed this here...so users on sandbox is marking this rule as complete atm

expect(metric.startSpan).toHaveBeenCalledWith({name: 'saveAlertRule'});
});

it('updates the alert onboarding task', async function () {
Copy link
Member Author

Choose a reason for hiding this comment

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

we are covering this in the file static/app/views/alerts/create.spec.tsx

/**
* A callback triggered when the rule is saved successfully
*/
onSaveSuccess?: () => void;
Copy link
Member Author

Choose a reason for hiding this comment

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

has to add this prop because the component is still class based :(

…' of github.com:getsentry/sentry into priscila/ref/quick-start/fix-animation-reordering-issue
@priscilawebdev priscilawebdev force-pushed the priscila/ref/quick-start/fix-animation-reordering-issue branch from 397ce31 to 688264b Compare March 27, 2025 14:02
Copy link
Member

@obostjancic obostjancic left a comment

Choose a reason for hiding this comment

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

LGTM, lets just check it out in the demo mode before we merge!

Comment on lines -14 to -38
describe('updateOnboardingTask', function () {
it('Adds the task to the organization when task does not exists', async function () {
const detailedOrg = OrganizationFixture();

// User is not passed into the update request
const testTask = {
task: OnboardingTaskKey.FIRST_PROJECT,
status: 'complete',
} as const;

const mockUpdate = MockApiClient.addMockResponse({
url: `/organizations/${detailedOrg.slug}/onboarding-tasks/`,
method: 'POST',
body: testTask,
});

updateOnboardingTask(api, detailedOrg, testTask);
await tick();

expect(mockUpdate).toHaveBeenCalled();

expect(OrganizationStore.onUpdate).toHaveBeenCalledWith({
onboardingTasks: [{...testTask, user}],
});
});
Copy link
Member

Choose a reason for hiding this comment

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

yep, seems good to go

Comment on lines 310 to 315
if (isDemoModeActive()) {
updateDemoWalkthroughTask({
task: task.task,
status: 'skipped',
completionSeen: true,
});
Copy link
Member

Choose a reason for hiding this comment

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

I'd do an early return here for demo mode since I don't think we'll add a skip task feature there anytime soon.

@obostjancic obostjancic requested a review from Copilot March 27, 2025 15:26
Copy link
Contributor

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.

Pull Request Overview

This PR addresses the quick-start animation reordering issue by ensuring all promises resolve before updating the state and updates the onboarding tasks flow by switching from the old updateOnboardingTask function to a React Query mutation hook. Additionally, the PR removes outdated code and test mocks, modernizing several components and related tests concerning onboarding tasks and demo mode.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
static/app/views/alerts/rules/issue/index.tsx Removed updateOnboardingTask import and added the onSaveSuccess callback in the IssueRuleEditor.
static/app/views/alerts/rules/issue/index.spec.tsx Updated tests by removing references and mocks for updateOnboardingTask.
static/app/views/alerts/create.tsx Integrated useUpdateOnboardingTasks and updated the onSaveSuccess handler with demo mode check.
static/app/views/alerts/create.spec.tsx Updated test mocks to use the new update hook and verified onboarding task mutation.
static/app/types/onboarding.tsx Removed the AvatarUser type from OnboardingTaskStatus.
static/app/components/sidebar/onboardingStatus.spec.tsx Removed the static user property from onboarding task objects in tests.
static/app/components/onboardingWizard/content.tsx Refactored onboarding wizard workflows: replaced updateOnboardingTask with useUpdateOnboardingTasks and updated demo mode handling via updateDemoWalkthroughTask.
static/app/components/nav/primary/onboarding.spec.tsx Removed obsolete user field when verifying onboarding status in tests.
static/app/components/externalIssues/ticketRuleModal.spec.tsx Removed the mocking for updateOnboardingTask.
static/app/actionCreators/onboardingTasks.tsx Replaced updateOnboardingTask with the new custom useUpdateOnboardingTasks hook leveraging React Query mutation.
static/app/actionCreators/onboardingTasks.spec.tsx Updated tests to validate the new hook’s behavior and removed legacy tests.
static/app/actionCreators/guides.tsx Updated the demo walkthrough task completion to use updateDemoWalkthroughTask.
Comments suppressed due to low confidence (1)

static/app/components/onboardingWizard/content.tsx:437

  • In demo mode, updateDemoWalkthroughTask is called later with the task object but without an explicit 'status' field (unlike other usages where 'status' is provided). Confirm if this discrepancy is intentional or if a status should be added for consistency.
.map(task => ({...task, completionSeen: true}))

@priscilawebdev
Copy link
Member Author

priscilawebdev commented Mar 28, 2025

LGTM, lets just check it out in the demo mode before we merge!

I checked whether the changes break when demo mode is active, and everything seems fine. However, I did come across a few unrelated bugs, which I’ve shared internally.

@priscilawebdev priscilawebdev marked this pull request as ready for review March 28, 2025 06:32
@priscilawebdev priscilawebdev requested a review from a team as a code owner March 28, 2025 06:32
@priscilawebdev priscilawebdev requested review from a team and shellmayr March 28, 2025 06:32
@priscilawebdev priscilawebdev merged commit d0ecb45 into master Mar 28, 2025
40 checks passed
@priscilawebdev priscilawebdev deleted the priscila/ref/quick-start/fix-animation-reordering-issue branch March 28, 2025 06:33
andrewshie-sentry pushed a commit that referenced this pull request Mar 31, 2025
- Fixes the weird reordering animation in Quick Start by using
Promise.all to ensure all promises are resolved before updating the
Organization Store.
- Updates the action function to use the React Query mutation hook.
- When the demo is active, the updateDemoWalkthroughTask function can
now be used directly, eliminating the need for the updateOnboardingTask
function - so, it got removed.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants