Skip to content

Commit

Permalink
fix(onboarding-analytics): Do not fire modal closed event on configur…
Browse files Browse the repository at this point in the history
…e or skip click (#77628)

With previous implementation, `onClose` function was called on every
modal closing event, including clicking on "Skip" or "Configure SDK"
button. Since those 2 events are already tracked by analytics, we wanted
to fire `project_creation.select_framework_modal_close_button_clicked`
only when close button was clicked, so the `closeModal` callback call
was removed from the functions that handle "configure sdk" and "Skip"
button clicks

Part of #77391

---------

Signed-off-by: Vjeran Grozdanic <vjeran.grozdanic@sentry.io>
  • Loading branch information
vgrozdanic committed Sep 20, 2024
1 parent a5999b3 commit 0c446e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {initializeOrg} from 'sentry-test/initializeOrg';
import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';
import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';

import {
makeClosableHeader,
Expand Down Expand Up @@ -73,8 +73,5 @@ describe('Framework suggestion modal', function () {
expect(screen.getByRole('button', {name: 'Configure SDK'})).toBeEnabled();

await userEvent.click(screen.getByRole('button', {name: 'Skip'}));
await waitFor(() => {
expect(closeModal).toHaveBeenCalled();
});
});
});
13 changes: 2 additions & 11 deletions static/app/components/onboarding/frameworkSuggestionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,7 @@ export function FrameworkSuggestionModal({
);

onConfigure(selectedFramework);
closeModal();
}, [
selectedPlatform,
selectedFramework,
organization,
onConfigure,
closeModal,
newOrg,
]);
}, [selectedPlatform, selectedFramework, organization, onConfigure, newOrg]);

const handleSkip = useCallback(() => {
trackAnalytics(
Expand All @@ -230,8 +222,7 @@ export function FrameworkSuggestionModal({
}
);
onSkip();
closeModal();
}, [selectedPlatform, organization, closeModal, onSkip, newOrg]);
}, [selectedPlatform, organization, onSkip, newOrg]);

const listEntries = [...topFrameworksOrdered, ...otherFrameworksSortedAlphabetically];

Expand Down

0 comments on commit 0c446e4

Please sign in to comment.