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

[WNMGDS-2714] Fix Dialog and HelpDrawer analytics firing too early #3055

Merged
merged 9 commits into from
Apr 25, 2024

Conversation

pwolfert
Copy link
Collaborator

Summary

Fixes Dialog and HelpDrawer analytics open event firing before it's actually opened. When we changed the NativeDialog API to use an isOpen prop to control its open state, it meant that rendering a NativeDialog was no longer equivalent to opening a dialog. Our analytics events for Dialog and HelpDrawer open and close were based on mounting and unmounting the components, so when one of those comonents rendered, it would fire the open event even if isOpen was false.

How to test

  1. Take a look a the unit tests
  2. Take a look at the analytics logging in Storybook

Checklist

  • Prefixed the PR title with the Jira ticket number as [WNMGDS-####] Title or [NO-TICKET] if this is unticketed work.
  • Selected appropriate Type (only one) label for this PR, if it is a breaking change, label should only be Type: Breaking
  • Selected appropriate Impacts, multiple can be selected.
  • Selected appropriate release milestone

If this is a change to code:

  • Created or updated unit tests to cover any new or modified code
  • If necessary, updated unit-test snapshots (yarn test:unit:update) and browser-test snapshots (yarn test:browser:update)

@pwolfert pwolfert added Type: Fixed Indicates an unexpected problem or unintended behavior Impacts: Core Impacts the core DS primarily, changes may occur in other themes as well. labels Apr 24, 2024
@pwolfert pwolfert added this to the 10.0.1 milestone Apr 24, 2024
Copy link
Collaborator

@zarahzachz zarahzachz left a comment

Choose a reason for hiding this comment

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

seeing weird behavior for onEnter with Dialog (discussed in office hours)

@@ -52,9 +62,31 @@ describe('HelpDrawer', () => {
jest.resetAllMocks();
});

it('sends analytics event tracking on open help drawer', () => {
renderHelpDrawer();
it("does not send analytics event when dialog isn't open", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does calling the tests "dialog" matter if it's underlying element is <dialog> 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

doh!

pwolfert added a commit that referenced this pull request Apr 25, 2024
I can find no evidence of people using it, and it has the same defect as #3055
@pwolfert pwolfert merged commit 999c44f into main Apr 25, 2024
1 check passed
@pwolfert pwolfert deleted the pwolfert/dialog-analytics-fix branch April 25, 2024 19:54
pwolfert added a commit that referenced this pull request Apr 25, 2024
Remove this worthless callback that has a bug

I can find no evidence of people using it, and it has the same defect as #3055
pwolfert added a commit that referenced this pull request May 10, 2024
#3055)

* Fix `Dialog` firing open and close events at wrong time

* Separate that logic into a hook so it can be shared

* Apply the fix to `HelpDrawer` too

* Update snapshots again after rebasing

* Fix analytics in help drawer story

* Fix copypasta in test names

* Oh, snapshots have to be updated when the names change
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impacts: Core Impacts the core DS primarily, changes may occur in other themes as well. Type: Fixed Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants