-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix(nuxt): reset page:loading:end
hook before navigation
#31504
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
|
@nuxt/kit
nuxt
@nuxt/schema
@nuxt/rspack-builder
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #31504 will not alter performanceComparing Summary
|
WalkthroughThe changes introduce additional logic to manage page loading events in a Nuxt application. In the runtime page component, a new conditional block checks for a client environment and sets up a router navigation guard that resets a flag associated with the loading end hook on every route change. A lifecycle hook is added to remove this subscription when the component unmounts, and a new variable refines the condition for triggering the hook, particularly when nested routes are involved. In the loading indicator composable, any pre-existing timeouts are cleared before starting a new loading process. Additionally, a new test file has been introduced to validate the loading indicator's behaviour during asynchronous route transitions. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code Definitions (1)test/nuxt/loading-indicator.test.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (5)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
page:loading:end
hook before navigation
🔗 Linked issue
Maybe a regression from #29009
📚 Description
The nuxt loading indicator is stuck loading forever because the
page:loading:end
hook is not triggered.This seems to be caused by the condition on
pageLoadingEndHookAlreadyCalled
which istrue
:nuxt/packages/nuxt/src/pages/runtime/page.ts
Line 162 in 36e5cfd
I have added in this PR a new test that currently fails and demonstrates the issue.