Skip to content

Fix My Jetpack route crash in Chrome (And Protect)#50465

Merged
dereksmart merged 1 commit into
trunkfrom
codex/fix-my-jetpack-scrollto-effect
Jul 13, 2026
Merged

Fix My Jetpack route crash in Chrome (And Protect)#50465
dereksmart merged 1 commit into
trunkfrom
codex/fix-my-jetpack-scrollto-effect

Conversation

@dereksmart

@dereksmart dereksmart commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Fixes: p1783960683602709-slack-C0299DMPG

Summary

  • Prevent the My Jetpack and Protect plugin ScrollToTop effect from returning the result of window.scrollTo().
  • Avoid React treating Chromium scroll API promises as effect cleanup callbacks on route changes.

Causes a blank page.

Why this happens in Chrome

ScrollToTop used a concise arrow effect: useEffect( () => window.scrollTo( 0, 0 ), [ location ] ). React treats any value returned from an effect callback as that effect cleanup. In Firefox, window.scrollTo( 0, 0 ) returns undefined, so there is no cleanup. In Chrome/Chromium, the same call can return a Promise; React stores that promise as the cleanup value and then tries to call it during the next route change/unmount. Because the promise is not a function, React throws from its effect cleanup path, which leaves the My Jetpack admin page blank.

The fix keeps the scroll behavior but uses a block body so the effect callback returns undefined consistently across browsers.

Testing instructions:

  • In Chrome
  • Click on top-level jetpack admin menu item
  • Click on all of these tabs:
image

Does this pull request change what data or activity we track or use?

No

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the codex/fix-my-jetpack-scrollto-effect branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack codex/fix-my-jetpack-scrollto-effect

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Protect plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 13, 2026
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/my-jetpack/_inc/admin.jsx 0/16 (0.00%) 0.00% 1 ❤️‍🩹

Full summary · PHP report · JS report

anomiex
anomiex previously approved these changes Jul 13, 2026

@anomiex anomiex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks reasonable. Fixes the issue on the JN site I was using for reproduction.

@dereksmart dereksmart marked this pull request as ready for review July 13, 2026 18:24
@dereksmart dereksmart added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels Jul 13, 2026
@dereksmart dereksmart self-assigned this Jul 13, 2026
@dereksmart dereksmart force-pushed the codex/fix-my-jetpack-scrollto-effect branch from 146166f to 65c9b8d Compare July 13, 2026 18:31
@dereksmart dereksmart changed the title Fix My Jetpack route crash in Chrome Fix My Jetpack route crash in Chrome (And Protect) Jul 13, 2026
@github-actions github-actions Bot added the [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. label Jul 13, 2026
@dereksmart dereksmart merged commit 5d0f321 into trunk Jul 13, 2026
96 of 99 checks passed
@dereksmart dereksmart deleted the codex/fix-my-jetpack-scrollto-effect branch July 13, 2026 18:53
@github-actions github-actions Bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] My Jetpack [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants