Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nuxtPublic

fix(nitro): clipboard copy in error overlay#33873

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
onmax wants to merge1 commit intonuxt:main
base:main
Choose a base branch
Loading
fromonmax:fix/error-overlay-clipboard

Conversation

@onmax
Copy link
Contributor

@onmaxonmax commentedDec 14, 2025
edited
Loading

Fixes#33872

Summary

  • Iframe overridescopyErrorMessage to send postMessage to parent
  • Parent registers clipboard handler immediately (before host check)
  • Parent callsnavigator.clipboard.writeText() which works in secure context

Reproduction

danielroe, Flo0806, and OrbisK reacted with heart emoji
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz CodeflowRun & review this pull request inStackBlitz Codeflow.

@danielroedanielroe changed the titlefix(nitro-server): clipboard copy in error overlayfix(nitro): clipboard copy in error overlayDec 14, 2025
@pkg-pr-new
Copy link

pkg-pr-newbot commentedDec 14, 2025
edited
Loading

Open in StackBlitz

@nuxt/kit

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

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@33873

nuxt

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

@nuxt/rspack-builder

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

@nuxt/schema

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

@nuxt/vite-builder

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

@nuxt/webpack-builder

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

commit:ea8debf

@coderabbitai
Copy link

coderabbitaibot commentedDec 14, 2025
edited
Loading

Walkthrough

Adds a postMessage-based clipboard relay between iframe and parent in dev utilities. The iframe registers a DOMContentLoaded handler to sendclipboard-copy messages including a nonce and UI badge target; the parent defines the same nonce, listens forclipboard-copy messages, and invokesnavigator.clipboard.writeText to perform writes from the secure parent context. The flow integrates with existing storage-sync and event messaging; no public/exported API signatures were changed.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title 'fix(nitro): clipboard copy in error overlay' accurately summarizes the main change—fixing clipboard functionality in the error overlay component.
Description check✅ PassedThe description is directly related to the changeset, explaining the fix mechanism (postMessage delegation), the rationale (secure context requirement), and providing reproduction links.
Linked Issues check✅ PassedThe pull request implements the proposed solution from issue#33872 by delegating clipboard operations from the iframe to the parent window using postMessage, addressing the root cause of the clipboard failure.
Out of Scope Changes check✅ PassedAll changes are scoped to fixing the clipboard copy functionality in the error overlay as specified in issue#33872; no out-of-scope modifications are present.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 betweenb7fc136 andea8debf.

📒 Files selected for processing (1)
  • packages/nitro-server/src/runtime/utils/dev.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/nitro-server/src/runtime/utils/dev.ts
⏰ 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). (20)
  • 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, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, dev, vite, default, manifest-off, 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, async, 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 (windows-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, async, manifest-off, 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, default, manifest-off, 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: release-pkg-pr-new
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: test-benchmark
  • GitHub Check: test-size
  • GitHub Check: code

Thanks for usingCodeRabbit! 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

@coderabbitaicoderabbitaibot 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: 1

🧹 Nitpick comments (2)
packages/nitro-server/src/runtime/utils/dev.ts (2)

91-94:Consider logging errors and validating text parameter.

The clipboard write silently swallows all errors, which makes debugging difficult. Additionally, there's no validation thate.data.text is defined.

Apply this diff to improve error handling and validation:

   window.addEventListener('message', function(e) {     if (e.data && e.data.type === 'clipboard-copy' && e.data.nonce === NONCE) {-      navigator.clipboard.writeText(e.data.text).catch(function() {});+      if (typeof e.data.text === 'string') {+        navigator.clipboard.writeText(e.data.text).catch(function(err) {+          console.warn('Failed to write to clipboard:', err);+        });+      }     }   });

76-83:Consider adding defensive checks if this function will be called from dynamic error overlays.

ThecopyErrorMessage function currently lacks validation for thebutton parameter and itsdataset.errorText property. While this function isn't currently invoked anywhere in the codebase, adding defensive checks would be prudent if it's intended for future use or integration with dynamically generated error overlays:

   document.addEventListener('DOMContentLoaded', function() {     window.copyErrorMessage = function(button) {+      if (!button || !button.dataset || !button.dataset.errorText) return;       window.parent.postMessage({ type: 'clipboard-copy', text: button.dataset.errorText, nonce: NONCE }, '*');       button.classList.add('copied');       setTimeout(function() { button.classList.remove('copied'); }, 2000);     };   });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between01d459e andb7fc136.

📒 Files selected for processing (1)
  • packages/nitro-server/src/runtime/utils/dev.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • packages/nitro-server/src/runtime/utils/dev.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,vue}: Use clear, descriptive variable and function names
Add comments only to explain complex logic or non-obvious implementations
Keep functions focused and manageable (generally under 50 lines), and extract complex logic into separate domain-specific files
Remove code that is not used or needed
Use error handling patterns consistently

Files:

  • packages/nitro-server/src/runtime/utils/dev.ts
⏰ 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). (20)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite-env-api, 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, dev, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, webpack, async, 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, dev, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, rspack, async, 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, built, vite, default, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (windows-latest, built, webpack, async, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-on, js, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite, async, manifest-off, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, dev, vite, default, manifest-on, json, lts/-1)
  • GitHub Check: test-fixtures (ubuntu-latest, built, vite-env-api, async, manifest-on, json, lts/-1)
  • GitHub Check: release-pkg-pr-new
  • GitHub Check: typecheck (ubuntu-latest, bundler)
  • GitHub Check: test-benchmark
  • GitHub Check: typecheck (windows-latest, bundler)
  • GitHub Check: test-size
  • GitHub Check: code

@onmaxonmaxforce-pushed thefix/error-overlay-clipboard branch fromb7fc136 to9d2b392CompareDecember 14, 2025 13:42
@onmaxonmaxforce-pushed thefix/error-overlay-clipboard branch from9d2b392 toea8debfCompareDecember 14, 2025 13:43
@onmax
Copy link
ContributorAuthor

addressed comments from rabbit.

ready for merge!

@codspeed-hq
Copy link

CodSpeed Performance Report

Merging#33873 willimprove performances by 16.83%

Comparingonmax:fix/error-overlay-clipboard (ea8debf) withmain (01d459e)

Summary

⚡ 1 improvement
✅ 9 untouched

Benchmarks breakdown

BenchmarkBASEHEADChange
writeTypes in the basic-types fixture93.9 ms80.4 ms+16.83%

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@danielroedanielroeAwaiting requested review from danielroedanielroe is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Error overlay copy button doesn't work

1 participant

@onmax

[8]ページ先頭

©2009-2025 Movatter.jp