fix(theme): scroll should work in afterNav #2779
Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Rsdoctor Bundle Diff Analysis📁 webPath:
📦 Download Diff Report: web Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes scroll behavior in the afterNav area by refactoring scroll-related hooks and reorganizing imports. The main change renames the useSetup function in useScrollAfterNav.ts to useScrollAfterNav (making its purpose clearer), and introduces two new hooks: useScrollReset for resetting scroll position on navigation, and a stub useSetup for compatibility.
Key changes:
- Renamed
useSetuptouseScrollAfterNavin the scroll after navigation logic to improve code clarity - Created
useScrollResethook to handle scroll position reset when navigating without hash - Refactored imports to use theme exports instead of direct relative imports
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/core/src/theme/logic/useSetup.ts |
New stub function for useSetup to maintain compatibility with existing imports |
packages/core/src/theme/logic/useScrollReset.ts |
New hook to reset scroll position on pathname changes when no hash is present |
packages/core/src/theme/logic/useScrollAfterNav.ts |
Renamed function from useSetup to useScrollAfterNav with documentation comments |
packages/core/src/theme/layout/Layout/index.tsx |
Updated imports to use theme exports and reorganized type imports |
packages/core/src/theme/layout/DocLayout/index.tsx |
Added useScrollReset hook call and updated to use theme exports |
packages/core/src/theme/index.ts |
Updated exports to include new hook locations and type exports |
packages/core/src/theme/components/DocContent/index.tsx |
Added useScrollAfterNav hook call to enable scroll-to-hash functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
fix(theme): scroll should work in afterNav
Related Issue
Checklist