Skip to content

Conversation

nfmohit
Copy link
Collaborator

@nfmohit nfmohit commented Aug 29, 2025

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

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@nfmohit nfmohit marked this pull request as ready for review September 2, 2025 15:32
Copy link
Collaborator

@techanvil techanvil left a 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:

Image

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:

Image

And after the snapshot:

Image

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.

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.

2 participants