-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix(nuxt): scroll to anchor if present when changing page without saved position #32376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 refactors the scroll position logic in the router options to improve code readability and to scroll to the hash element when present, while removing an unnecessary explicit 'instant' behavior parameter.
- Refactored the logic that determines the scroll position on page navigation
- Adjusted the _calculatePosition function signature and its usage in the scroll handler
CodSpeed Performance ReportMerging #32376 will not alter performanceComparing Summary
|
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
WalkthroughThe scroll behaviour logic in the router options file was refactored. The intermediate variable for scroll position was removed, and the parameters passed to the internal 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)`**/*.{ts,tsx}`: Follow standard TypeScript conventions and best practices
📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md) List of files the instruction was applied to:
`**/*.{ts,tsx,vue}`: Use clear, descriptive variable and function names Add comm...
📄 Source: CodeRabbit Inference Engine (.github/copilot-instructions.md) List of files the instruction was applied to:
🧠 Learnings (1)packages/nuxt/src/pages/runtime/router.options.ts (2)
🧬 Code Graph Analysis (1)packages/nuxt/src/pages/runtime/router.options.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🔗 Linked issue
resolves #32366
📚 Description
Moved logic which decides on scroll position to a single function for better readability. It now scrolls to hash if present when changing page without saved position. Removed explicit
instant
behavior as this appears to be the default one anyway.