Skip to content

fix(#2881): temporary notification set 0 to stop auto-dismiss#2882

Closed
vanessatran-ddi wants to merge 2 commits into
alphafrom
vanessa/2881
Closed

fix(#2881): temporary notification set 0 to stop auto-dismiss#2882
vanessatran-ddi wants to merge 2 commits into
alphafrom
vanessa/2881

Conversation

@vanessatran-ddi
Copy link
Copy Markdown
Collaborator

Before (the change)

  • Set duration 0 for the Temporary Notification, expects it will not auto-dismiss, but it is.

After (the change)

It will stop auto-dismiss the notification.

Make sure that you've checked the boxes below before you submit the PR

  • I have read and followed the setup steps
  • I have created necessary unit tests
  • I have tested the functionality in both React and Angular.

Steps needed to test

 TemporaryNotification.show("Basic message!", { type: "success", duration: 0 });


// Verify the notification is displayed
const notification = result.getByTestId("cancel-notification");
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The test failed in headless mode (passed in browser mode) because of a race condition. We query the notification outside the waitFor block, so we query it even before we trigger the temporary notification, that is why it failed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I always run in headless mode and it never failed. I am also not clear on what you mean by us querying it before triggering it.

@syedszeeshan
Copy link
Copy Markdown
Contributor

image

@vanessatran-ddi apparently this test keeps failing, tried couple of times

@syedszeeshan
Copy link
Copy Markdown
Contributor

image

@vanessatran-ddi And now it passed.
I have noticed that when I run ONLY this specific browser test (and no other test), then it passes.

@vanessatran-ddi
Copy link
Copy Markdown
Collaborator Author

Hi @chrisolsen This PR needs your code review.


// set default duration for certain notification types
if (!opts.duration && opts.type && TypesRequiringDuration.includes(opts.type)) {
if (opts.duration === undefined && opts.type && TypesRequiringDuration.includes(opts.type)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This works as well, but what is the reason for the change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

When we pass 0 as a number, the !opts.duration is true, and it doesn't work.


// Verify the notification is displayed
const notification = result.getByTestId("cancel-notification");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I always run in headless mode and it never failed. I am also not clear on what you mean by us querying it before triggering it.

@vanessatran-ddi
Copy link
Copy Markdown
Collaborator Author

image @vanessatran-ddi And now it passed. I have noticed that when I run ONLY this specific browser test (and no other test), then it passes.

Thank you @syedszeeshan Then it is kind of flaky.. I don't know, maybe we talk about it in the dev meeting?

@vanessatran-ddi
Copy link
Copy Markdown
Collaborator Author

We don't allow 0

@vanessatran-ddi vanessatran-ddi deleted the vanessa/2881 branch August 22, 2025 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants