Skip to content

Conversation

@cernymatej
Copy link
Member

🔗 Linked issue

resolves #33573

📚 Description

Non-critical errors will now initially show the error page instead of the error overlay.

@cernymatej cernymatej requested a review from danielroe as a code owner November 5, 2025 08:02
@bolt-new-by-stackblitz
Copy link

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

@cernymatej
Copy link
Member Author

Or should we not render the overlay for these status codes at all?
I can imagine it still being a bit annoying since we can't move it or close it like devtools.

@cernymatej cernymatej changed the title feat(nuxt): start error overlay minimized based on status code fix(nuxt): start error overlay minimized based on status code Nov 5, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Walkthrough

The changes introduce a startMinimized option to control the initial state of error overlays in development mode. In error.ts, when generating the error overlay HTML, a new options object is passed with startMinimized set to true for HTTP status codes between 300–499 and false otherwise. In dev.ts, the webComponentScript and generateErrorOverlayHTML function signatures are updated to accept and handle this startMinimized parameter, which controls the iframe's inert state and the button's aria-expanded attribute.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify the status code range logic (300–499) is the intended range for minimised errors
  • Confirm the parameter correctly flows through the call chain from error.ts through generateErrorOverlayHTML to webComponentScript
  • Review the iframe inert state and aria-expanded attribute changes for correct accessibility implications
  • Ensure backward compatibility when options is undefined (verify the ?? false fallback is appropriate)

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: starting the error overlay minimised based on HTTP status codes for non-critical errors.
Description check ✅ Passed The description is related to the changeset, explaining that non-critical errors will show the error page instead of the overlay, with a linked issue reference.
Linked Issues check ✅ Passed The PR directly addresses issue #33573 by minimising the error overlay for non-critical HTTP status codes (300–499), allowing error.vue pages to display initially instead of the full overlay.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the error overlay minimisation feature for non-critical status codes, with no extraneous modifications.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26aaf83 and 4ed69c5.

📒 Files selected for processing (2)
  • packages/nitro-server/src/runtime/handlers/error.ts (1 hunks)
  • packages/nitro-server/src/runtime/utils/dev.ts (3 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/nitro-server/src/runtime/handlers/error.ts
  • packages/nitro-server/src/runtime/utils/dev.ts
🧬 Code graph analysis (1)
packages/nitro-server/src/runtime/handlers/error.ts (1)
packages/nitro-server/src/runtime/utils/dev.ts (1)
  • generateErrorOverlayHTML (317-326)
⏰ 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). (19)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, rspack, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: test-benchmark
  • GitHub Check: test-size
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: code
🔇 Additional comments (5)
packages/nitro-server/src/runtime/utils/dev.ts (4)

210-210: Good addition of required parameter.

The startMinimized parameter is correctly typed as a required boolean rather than optional, which provides better type safety and prevents ambiguity.


302-305: LGTM: Correct initial state handling.

The conditional initialization correctly mirrors the toggle logic (lines 280-281), ensuring consistent behaviour between the initial minimized state and the toggled minimized state.


317-317: Well-designed optional parameter.

The optional options parameter maintains backward compatibility whilst allowing new functionality. The inline type definition is clear and appropriately scoped.


324-324: Proper optional chaining and default handling.

The combination of optional chaining (options?.startMinimized) and nullish coalescing (?? false) ensures a boolean is always passed whilst gracefully handling undefined options. The default of false (not minimized) maintains existing behaviour.

packages/nitro-server/src/runtime/handlers/error.ts (1)

88-88: Verify inclusion of 3xx status codes.

The condition 300 <= statusCode && statusCode < 500 includes both 3xx (redirects) and 4xx (client errors). Based on the PR objectives and issue #33573, which mention minimising for non-critical errors like 404/403 and keeping expanded for HTTP 500+ errors:

  • 4xx (client errors) → non-critical → minimise ✓
  • 5xx (server errors) → critical → don't minimise ✓
  • 3xx (redirects) → not typically errors → should these be minimised?

Standard HTTP semantics treat 3xx as redirects, not errors. Consider whether the condition should be 400 <= statusCode && statusCode < 500 instead to exclude redirects from the minimised overlay behaviour.

Note: Line 20-24 handles some 3xx cases (404→302 redirect) and returns early, but other 3xx codes would still reach this logic.


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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 5, 2025

Open in StackBlitz

@nuxt/kit

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

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit: 4ed69c5

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 5, 2025

CodSpeed Performance Report

Merging #33658 will not alter performance

Comparing cernymatej:feat/minimize-error-overlay (4ed69c5) with main (26aaf83)

Summary

✅ 10 untouched

@danielroe
Copy link
Member

it would be nice to enable closing it (or moving it too, I guess!)

@danielroe danielroe merged commit f809e80 into nuxt:main Nov 5, 2025
55 of 57 checks passed
@cernymatej cernymatej deleted the feat/minimize-error-overlay branch November 5, 2025 09:44
@github-actions github-actions bot mentioned this pull request Nov 4, 2025
@github-actions github-actions bot mentioned this pull request Nov 6, 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.

Unable to disable nuxt-error-overlay

2 participants