Skip to content

Conversation

@Mini-ghost
Copy link
Member

🔗 Linked issue

N/A

📚 Description

  1. The useNuxtApp() call within showError is moved to be client-side only.
    Before
    截圖 2025-09-15 下午5 43 24
    After
    截圖 2025-09-15 下午5 38 14

  2. The useError composable 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
    截圖 2025-09-15 下午5 42 28
    After
    截圖 2025-09-15 下午5 41 06

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 15, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33234

nuxt

npm i https://pkg.pr.new/nuxt@33234

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33234

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33234

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33234

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33234

commit: 7534600

@coderabbitai
Copy link

coderabbitai bot commented Sep 15, 2025

Walkthrough

  • Added a no-side-effects annotation comment (/* @__NO_SIDE_EFFECTS__ */) above the useError export.
  • In showError, deferred creation of nuxtApp by moving useNuxtApp() into the client-only branch under if (import.meta.client).
  • Hook invocation remains, with nuxtApp now scoped inside the client block.
  • No changes to exported/public API signatures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "refactor(nuxt): improve implementation of error composables" accurately summarises the primary change in the changeset — a refactor to Nuxt's error composables (moving useNuxtApp to client-only and adding a no-side-effects annotation) — and is concise, specific and relevant for a teammate scanning the history. It follows conventional commit style and contains no extraneous noise.
Description Check ✅ Passed The PR description clearly documents the implemented changes (moving useNuxtApp into a client-only branch and marking useError as no-side-effects) and includes before/after illustrations, so it is directly related to the changeset and satisfies this lenient check. The description aligns with the provided raw summary and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/improve-error-composables

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 explicit

Minor 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

📥 Commits

Reviewing files that changed from the base of the PR and between 412786a and 7534600.

📒 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 expectations

The 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-hq
Copy link

codspeed-hq bot commented Sep 15, 2025

CodSpeed Performance Report

Merging #33234 will not alter performance

Comparing refactor/improve-error-composables (7534600) with main (412786a)

Summary

✅ 10 untouched

Comment on lines 11 to +12
/** @since 3.0.0 */
/* @__NO_SIDE_EFFECTS__ */
Copy link
Member

@OrbisK OrbisK Sep 15, 2025

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.

Copy link
Member

Choose a reason for hiding this comment

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

@danielroe danielroe merged commit 0b1129e into main Sep 15, 2025
49 checks passed
@danielroe danielroe deleted the refactor/improve-error-composables branch September 15, 2025 10:08
This was referenced Sep 15, 2025
@github-actions github-actions bot mentioned this pull request Sep 19, 2025
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.

4 participants