-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
refactor(nuxt): improve implementation of error composables #33234
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/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/nuxt/src/app/composables/error.ts (1)
31-34: Good client‑only scoping; align hook call with NuxtApp API and make fire‑and‑forget explicitMinor consistency tidy‑up to match clearError and avoid floating promises:
- const nuxtApp = useNuxtApp() - nuxtApp.hooks.callHook('app:error', nuxtError) + const nuxtApp = useNuxtApp() + // fire-and-forget for client-only notification + void nuxtApp.callHook('app:error', nuxtError)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nuxt/src/app/composables/error.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
packages/nuxt/src/app/composables/error.ts
🧬 Code graph analysis (1)
packages/nuxt/src/app/composables/error.ts (1)
packages/nuxt/src/app/nuxt.ts (1)
useNuxtApp(547-560)
⏰ 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). (2)
- GitHub Check: build
- GitHub Check: code
🔇 Additional comments (1)
packages/nuxt/src/app/composables/error.ts (1)
12-13: Annotation looks correct for Rollup; verify cross‑bundler expectationsThe placement of /* @NO_SIDE_EFFECTS / immediately before the constant function declaration is valid for Rollup and will allow calls to be treated as side‑effect free when the result is unused. Keep this adjacent to the declaration in future edits. Note: esbuild does not recognise this annotation (it only supports / @PURE */ and package.json sideEffects), so the benefit is primarily for Rollup‑based bundling. Please confirm this aligns with your target toolchain(s). (rollupjs.org)
CodSpeed Performance ReportMerging #33234 will not alter performanceComparing Summary
|
| /** @since 3.0.0 */ | ||
| /* @__NO_SIDE_EFFECTS__ */ |
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.
I think we should to add this to the docstring above.
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.
🔗 Linked issue
N/A
📚 Description
The


useNuxtApp()call withinshowErroris moved to be client-side only.Before
After
The
useErrorcomposable is marked as no side-effect (/* @__NO_SIDE_EFFECTS__ */). This provides a hint to bundlers, allowing for better tree-shaking if the composable is not used.Before


After