Skip to content

fix(theme): scroll should work in afterNav #2779

Merged
SoonIter merged 4 commits intomainfrom
syt/fix-scroll
Nov 18, 2025
Merged

fix(theme): scroll should work in afterNav #2779
SoonIter merged 4 commits intomainfrom
syt/fix-scroll

Conversation

@SoonIter
Copy link
Member

Summary

fix(theme): scroll should work in afterNav

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings November 18, 2025 11:28
@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit b1fbbe4
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/691c5e5dc833ce0008074cb8
😎 Deploy Preview https://deploy-preview-2779--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

Rsdoctor Bundle Diff Analysis

📁 web

Path: website/doc_build/web/rsdoctor-data.json

Metric Current Baseline Change
📊 Total Size 14.3 MB 14.3 MB 8.6 KB (0.1%)
📄 JavaScript 13.7 MB 13.7 MB 8.6 KB (0.1%)
🎨 CSS 109.1 KB 109.1 KB 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 496.7 KB 496.7 KB 0 B (0.0%)

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useSetup to useScrollAfterNav in the scroll after navigation logic to improve code clarity
  • Created useScrollReset hook 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.

@SoonIter SoonIter enabled auto-merge (squash) November 18, 2025 12:06
@SoonIter SoonIter merged commit 8fd1e58 into main Nov 18, 2025
9 checks passed
@SoonIter SoonIter deleted the syt/fix-scroll branch November 18, 2025 12:07
@SoonIter SoonIter mentioned this pull request Nov 18, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants