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

fix: remove same-tag notifications before showing new ones #24302

Merged
merged 1 commit into from Jul 3, 2020

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Jun 25, 2020

Description of Change

Closes #24290.

Fixes an issue where notifications where not being closed properly when more than one notification was created in the renderer process with the same tag.

Per spec: https://notifications.spec.whatwg.org/#showing-a-notification

Screen Shot 2020-07-01 at 9 15 14 PM

Tested with https://gist.github.com/fd16a663434667d2096cd31ec7f2662f.

cc @MarshallOfSound @zcbenz

Checklist

Release Notes

Notes: Fixed an issue where some old notifications were not properly removed from the Notification Center on macOS.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 25, 2020
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

This isn't expected behavior, we don't want to dismiss the previous notification before showing a new one.

The line you reference here -->

is intended to close this notification before showing it again as you can re-use Notification instances in the main process.

In other words, this:

This ensures that, like we do in the main API

Is wrong

And we don't want to do this:

we explicitly close the most recent notification from the Notification Center on macOS before creating and displaying a new one.

as it isn't in any way expected, we want to have the ability to stack multiple notifications in the notification center.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 26, 2020
@codebytere codebytere requested a review from a team as a code owner July 2, 2020 02:04
@codebytere codebytere changed the title fix: remove notifications before showing new ones fix: remove duplicate-tagged notifications before showing new ones Jul 2, 2020
@codebytere codebytere changed the title fix: remove duplicate-tagged notifications before showing new ones fix: remove same-tag notifications before showing new ones Jul 2, 2020
@codebytere codebytere force-pushed the fix-notif-removal branch 4 times, most recently from faede9c to 91ce7de Compare July 3, 2020 02:23
@codebytere codebytere merged commit fd0eaf4 into master Jul 3, 2020
@release-clerk
Copy link

release-clerk bot commented Jul 3, 2020

Release Notes Persisted

Fixed an issue where some old notifications were not properly removed from the Notification Center on macOS.

@trop
Copy link
Contributor

trop bot commented Jul 3, 2020

I have automatically backported this PR to "10-x-y", please check out #24404

@trop trop bot removed the target/10-x-y label Jul 3, 2020
@trop
Copy link
Contributor

trop bot commented Jul 3, 2020

I have automatically backported this PR to "8-x-y", please check out #24405

@trop trop bot added the in-flight/10-x-y label Jul 3, 2020
@trop
Copy link
Contributor

trop bot commented Jul 3, 2020

I have automatically backported this PR to "9-x-y", please check out #24406

sentialx pushed a commit to sentialx/electron that referenced this pull request Jul 30, 2020
@r0stig
Copy link
Contributor

r0stig commented Sep 23, 2020

I think this PR introduced an old bug, explained in this issue: #17706

Quick tldr: when showing a new notification with the same tag as the one before both the newly created notification and the one before gets it's onclose callback called and the user can't click on the notification (the onclick handler won't fire).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants