-
Notifications
You must be signed in to change notification settings - Fork 317
Add the ability to pin notifications #11394
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
base: develop
Are you sure you want to change the base?
Conversation
…t a pinned notification at the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nfmohit, thanks for working on this.
Unfortunately though, in my testing it's not working as expected. I'm seeing this error when returning to the dashboard from OAuth:

Here's a screencast:
10890-error-returning-from-oauth.webm
Digging in, it looks like snapshotting is stripping the Component
, check
, and checkRequirements
functions out of the state.
Here I've console logged the queuedNotifications
array before the snapshot:

And after the snapshot:

This is something we overlooked at the IB stage. It's not possible to serialise functions to JSON, so the CORE_NOTIFICATIONS
datastore is not a good candidate for snapshotting. In fact, it's not good practice to store functions in state at all, for this reason. We should ideally refactor our state management to avoid this, but this is something to address separately - I'll add an issue to look into this.
In the meantime, we'll need to change the approach for this enhancement. For example, we could store the pinned state in a separate store which can be snapshotted.
On a separate note, we actually have a workaround for this bug in develop
whereby we've lowered the priority for the affected notifications. We should revert the priority to PRIORITY.SETUP_CTA_LOW
in this PR, we don't need to wait until it's merged.
priority: 130, // TODO: Revert this back to PRIORITY.SETUP_CTA_LOW after fixing https://github.com/google/site-kit-wp/issues/10890. |
priority: 140, // TODO: Revert this back to PRIORITY.SETUP_CTA_LOW after fixing https://github.com/google/site-kit-wp/issues/10890. |
Summary
Addresses issue:
Relevant technical choices
This PR adds the ability to pin notifications in case they need to appear after a subsequent page load, such as an OAuth flow for continuity.
PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist