fix: persist expanded text state of an item with query params#3060
Draft
Soxasora wants to merge 3 commits into
Draft
fix: persist expanded text state of an item with query params#3060Soxasora wants to merge 3 commits into
Soxasora wants to merge 3 commits into
Conversation
clicking `show full text` will save the `full` state to the query params. coming back to an item page with the `full` query param will now show the full text on first load.
show full text state of an item to query paramsThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8902b1d. Configure here.
Member
Author
This is an easy fix: |
uses `useSyncExternalStore` to render the expanded state from `sessionStorage` during the first render. coming back to an item page with the `full` query param will show the full text on first load.
… first render `full` query param removed as unused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Fixes #2818
After clicking
show full textwe now persist the expanded state of an item withfull=truein the query params.Coming back to an item with the
fullquery param will present the item already expanded. Solves scroll restoration in long posts.Screenshots
full-text.mp4
Additional Context
The
nprogressloading bar appears when clickingshow full textbecause we're doing a router action.Checklist
Are your changes backward compatible? Please answer below:
Yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
8
Did you use AI for this? If so, how much did it assist you?
No
Note
Low Risk
Low-risk UI state change using shallow routing; may trigger the nprogress bar on expand as noted in the PR.
Overview
Expanded post text now survives navigation and reloads via a
full=truequery parameter instead of living only in component state.useOverflowinitializesshowfromrouter.query.full, and clicking show full text performs a shallowrouter.replacethat mergesfull: trueinto the current query while still callingsetShow(true). Hash-based expansion is unchanged in behavior but only forcesshowto true (it no longer collapses expanded text when the URL has no hash).Reviewed by Cursor Bugbot for commit 8902b1d. Bugbot is set up for automated code reviews on this repo. Configure here.