fix: Fix hash scrolling with resetScroll={false}#7464
Conversation
|
View your CI Pipeline Execution ↗ for commit efcc684
☁️ Nx Cloud last updated this comment at |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR fixes scroll restoration behavior in TanStack Router by refactoring the inline script API from an options object to positional parameters, updating the script generation and scroll handler flow logic, and adding comprehensive unit and end-to-end test coverage for hash-based and SSR scroll key restoration scenarios. ChangesScroll Restoration Fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
🚀 Changeset Version Preview1 package(s) bumped directly, 22 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/router-core/tests/scroll-restoration-script.test.ts`:
- Around line 85-137: Add a regression test that covers the "missing restoration
key" case by creating a router via createScrollRestorationRouter(), generating
its script with getScrollRestorationScriptForRouter(router), stubbing scrollTo,
setting window.history.replaceState to contain a __TSR_key that does not exist
in sessionStorage, and storing sessionStorage[storageKey] as a JSON object that
omits that key (so elementEntries === undefined). Then call
runScrollRestorationScript(script) and assert it does not throw and that
scrollTo was called with (0, 0) to verify fallback-to-top behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 452474da-4863-4210-b954-fdf6b0823f62
📒 Files selected for processing (12)
.changeset/scroll-restoration-fixes.mde2e/react-start/scroll-restoration/src/routeTree.gen.tse2e/react-start/scroll-restoration/src/router.tsxe2e/react-start/scroll-restoration/src/routes/(tests)/hash-scroll-repro.tsxe2e/react-start/scroll-restoration/src/routes/(tests)/ssr-scroll-key.tsxe2e/react-start/scroll-restoration/tests/app.spec.tse2e/react-start/scroll-restoration/tests/hash-scroll-repro.spec.tse2e/react-start/scroll-restoration/tests/ssr-scroll-key.spec.tspackages/router-core/src/scroll-restoration-inline.tspackages/router-core/src/scroll-restoration-script/server.tspackages/router-core/src/scroll-restoration.tspackages/router-core/tests/scroll-restoration-script.test.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Merging this PR will not alter performance
Comparing Footnotes
|
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests