docs: add missing scroll restoration properties to RouterOptionsType.md and link to the official scroll restoration guide to their docstrings#7574
Conversation
Noticed that the entire suite of scroll restoration configurations (scrollRestoration, getScrollRestorationKey, scrollRestorationBehavior, and scrollToTopSelectors) present in router.d.ts were completely undocumented on the RouterOptionsType page. Added documentation for all four properties using the docstrings in router.ts plus links to the existing scroll restoration guide.
Added documentation links for scroll restoration options.
📝 WalkthroughWalkthroughThis PR adds documentation for scroll restoration configuration in RouterOptions, including definitions for ChangesScroll Restoration Configuration Documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 `@docs/router/api/router/RouterOptionsType.md`:
- Line 421: Update the malformed internal links to the Scroll Restoration Guide
by removing the extra slash before the fragment: replace occurrences of
"../../guide/scroll-restoration.md/#scroll-restoration" (and similar links
referenced near the "Scroll Restoration Guide" link text) with
"../../guide/scroll-restoration.md#scroll-restoration" in the
RouterOptionsType.md file (also fix the same pattern at the other reported
occurrences).
🪄 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: 3d1d795e-aff6-4ec6-9f32-d0d35afb9908
📒 Files selected for processing (2)
docs/router/api/router/RouterOptionsType.mdpackages/router-core/src/router.ts
| - Optional | ||
| - Defaults to `false` | ||
| - If `true`, scroll restoration will be enabled. | ||
| - See the [Scroll Restoration Guide](../../guide/scroll-restoration.md/#scroll-restoration) for more information. |
There was a problem hiding this comment.
Fix malformed internal scroll-restoration links (.md/#...).
These links include an extra / before the hash fragment, which can break internal doc navigation. Use ../../guide/scroll-restoration.md#... instead.
Suggested patch
-- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md/#scroll-restoration) for more information.
+- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md#scroll-restoration) for more information.
...
-- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md/#custom-cache-keys) for more information.
+- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md#custom-cache-keys) for more information.
...
-- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md/#scroll-behavior) for more information.
+- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md#scroll-behavior) for more information.
...
-- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md/#hashtop-of-page-scrolling) for more information.
+- See the [Scroll Restoration Guide](../../guide/scroll-restoration.md#hashtop-of-page-scrolling) for more information.Based on learnings and coding guidelines, docs/router links should remain file-relative and correctly formed for internal navigation.
Also applies to: 431-431, 441-441, 451-451
🤖 Prompt for 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.
In `@docs/router/api/router/RouterOptionsType.md` at line 421, Update the
malformed internal links to the Scroll Restoration Guide by removing the extra
slash before the fragment: replace occurrences of
"../../guide/scroll-restoration.md/#scroll-restoration" (and similar links
referenced near the "Scroll Restoration Guide" link text) with
"../../guide/scroll-restoration.md#scroll-restoration" in the
RouterOptionsType.md file (also fix the same pattern at the other reported
occurrences).
Sources: Coding guidelines, Learnings
The documentation for configuring a Router instance is missing these 4 properties:
This PR
Summary by CodeRabbit
scrollRestoration,getScrollRestorationKey,scrollRestorationBehavior, andscrollToTopSelectors. These new options enable customizable scroll behavior and restoration key management for improved user navigation experience.