[codex] Add Query Details copy actions#1520
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThis PR adds clipboard copy functionality to the Query Details sheet. A new CopyToClipboardButton component handles copying text with visual feedback (icon swap, "Copied" tooltip, auto-reset). The SQL code block and Recommendations header each receive a copy button; recommendations use formatQueryAnalysisCopyText() to compose summary, bullets, and improved SQL/Prisma sections. A test mocks navigator.clipboard.writeText and verifies both copy actions produce the expected payloads. Documentation and a changeset note the feature. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
Compute preview deployed. Branch: |
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/studio/views/queries/QueriesView.test.tsx`:
- Around line 1352-1357: The test stubs navigator.clipboard via
Object.defineProperty but never restores the original descriptor, causing global
leakage; capture the original descriptor with const originalClipboard =
Object.getOwnPropertyDescriptor(navigator, "clipboard") before calling
Object.defineProperty(navigator, "clipboard", { value: { writeText },
configurable: true }), and then restore it in a finally/afterEach block (or
after the test) by calling Object.defineProperty(navigator, "clipboard",
originalClipboard || {}) or deleting the property if originalClipboard is
undefined so both occurrences (the block around navigator.clipboard and the
similar block at the other spot) properly restore the global state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: db683638-f40c-4894-a4e6-760061db2bf2
📒 Files selected for processing (4)
.changeset/good-turtles-lie.mdFEATURES.mdui/studio/views/queries/QueriesView.test.tsxui/studio/views/queries/QueriesView.tsx
Summary
@prisma/studio-core.Validation
pnpm test ui/studio/views/queries/QueriesView.test.tsxpnpm typecheckpnpm exec eslint --cache --cache-location ./node_modules/.cache/eslint --no-warn-ignored ui/studio/views/queries/QueriesView.tsx ui/studio/views/queries/QueriesView.test.tsx FEATURES.md .changeset/good-turtles-lie.mdpnpm changeset status --since origin/mainpnpm demo:ppg: opened Query Details, verified both copy buttons are visible, and verified clipboard payloads for SQL and recommendation.