Skip to content

docs: add missing scroll restoration properties to RouterOptionsType.md and link to the official scroll restoration guide to their docstrings#7574

Open
darreleng wants to merge 2 commits into
TanStack:mainfrom
darreleng:patch-1
Open

Conversation

@darreleng

@darreleng darreleng commented Jun 7, 2026

Copy link
Copy Markdown

The documentation for configuring a Router instance is missing these 4 properties:

  • scrollRestoration
  • getScrollRestorationKey
  • scrollRestorationBehavior
  • scrollToTopSelectors

This PR

  • adds documentation for them using the existing docstrings in router.ts, plus links to the official scroll restoration guide
  • adds said links to their docstrings

Summary by CodeRabbit

  • Documentation
    • Added documentation for four new scroll restoration configuration options: scrollRestoration, getScrollRestorationKey, scrollRestorationBehavior, and scrollToTopSelectors. These new options enable customizable scroll behavior and restoration key management for improved user navigation experience.

darreleng added 2 commits June 7, 2026 18:21
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.
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds documentation for scroll restoration configuration in RouterOptions, including definitions for scrollRestoration, getScrollRestorationKey, scrollRestorationBehavior, and scrollToTopSelectors. Documentation entries include type signatures, default values, and descriptions. JSDoc comments reference the scroll restoration guide.

Changes

Scroll Restoration Configuration Documentation

Layer / File(s) Summary
Scroll restoration property definitions and references
docs/router/api/router/RouterOptionsType.md, packages/router-core/src/router.ts
Four scroll-related configuration properties are documented in RouterOptions with their type signatures, defaults, and descriptions. JSDoc comments in router.ts are updated with guide links for each property.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

package: router-core

Poem

🐰 Four scrolling options find their place,
With docs that guide at perfect pace,
scrollRestoration, keys held tight,
And selectors positioned right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main changes: adding four missing scroll restoration properties to documentation and linking to the official guide.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 757d433 and 49bc8d7.

📒 Files selected for processing (2)
  • docs/router/api/router/RouterOptionsType.md
  • packages/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.

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant