-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Reader: fix broken back navigation when mounting reader onboarding #99123
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~13 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
@Addison-Stavlo added you as a reviewer because I want to make sure I'm not breaking anything from #98679 |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
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.
LGTM
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.
Works great, thank you!
When working on reproducing #98359, I discovered a similar but unrelated bug that was introduced in #98679 where the browser's history state gets reset when the
<ReaderOnboarding/>
component mounts. This component mounts whenever the "stream" view of the Reader Recent feed is loaded, whether it's rendered or not. This causes the browser's back navigation to break whenever a user visited the recent stream view at/read
.Screen.Recording.2025-01-30.at.11.47.02.AM.mov
Proposed Changes
useEffect
callback logic to only update the router state when the related query param is presentpage.redirect
instead ofhistory.replaceState
so this navigation is using the router library directly. This should have the same effect asreplaceState
but we don't have to worry about manually copying over state. Docs for that method here: https://visionmedia.github.io/page.js/#pageredirectpathScreen.Recording.2025-01-30.at.12.11.26.PM.mov
Why are these changes being made?
Testing Instructions
/read
with a new user so onboarding is shown. Make sure you are viewing the "stream" view./read
with the stream view active.Pre-merge Checklist