Skip to content

chore(studio): show toast after copying strings to clipboard - #41401

Merged
joshenlim merged 1 commit into
masterfrom
chore/add-toast-when-copying-api-keys
Dec 17, 2025
Merged

joshenlim merged 1 commit into
masterfrom
chore/add-toast-when-copying-api-keys

Conversation

@fsansalvadore

@fsansalvadore fsansalvadore commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Add toast message after successfully copying a string from the command menu options.

Screenshot 2025-12-16 at 17 08 46

toast:
Screenshot 2025-12-16 at 17 08 51

Summary by CodeRabbit

  • New Features
    • Added success notifications when copying API keys and API URLs to clipboard. Users now receive instant visual confirmation confirming successful copy operations for all key types, enhancing the user experience with clear action acknowledgment.

✏️ Tip: You can customize this high-level summary in your review settings.

@fsansalvadore
fsansalvadore requested a review from a team as a code owner December 16, 2025 16:09
@vercel

vercel Bot commented Dec 16, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Dec 16, 2025 4:09pm
studio-staging Ready Ready Preview, Comment Dec 16, 2025 4:09pm
6 Skipped Deployments
Project Deployment Review Updated (UTC)
studio Ignored Ignored Dec 16, 2025 4:09pm
cms Skipped Skipped Dec 16, 2025 4:09pm
design-system Skipped Skipped Dec 16, 2025 4:09pm
docs Skipped Skipped Dec 16, 2025 4:09pm
ui-library Skipped Skipped Dec 16, 2025 4:09pm
zone-www-dot-com Skipped Skipped Dec 16, 2025 4:09pm

@supabase

supabase Bot commented Dec 16, 2025

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Two CommandMenu components are enhanced to provide visual feedback when users copy API keys or the API URL. Toast notifications now display success messages upon clipboard copy completion.

Changes

Cohort / File(s) Change Summary
Toast notifications for clipboard feedback
apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx, apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
Added toast import from 'sonner' and updated copy-to-clipboard callbacks to trigger toast.success() messages confirming successful copy actions for API keys and API URL

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Repetitive pattern applied consistently across two files with no logic complexity
  • Simple callback integrations with existing copy mechanisms
  • No control flow or error handling modifications

Poem

🐰 A toast to the clipboard, hooray, hooray!
With sonic success at the end of the day,
Keys copied, URLs smooth as can be,
Feedback so sweet, as delightful as tea! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. It lacks required sections from the template (CONTRIBUTING.md acknowledgment, change type, current behavior, new behavior structure). Add the missing template sections: confirm reading CONTRIBUTING.md, specify change type (chore), explain current behavior, and structure the new behavior section properly.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding toast notifications when copying strings to clipboard in the studio UI.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/add-toast-when-copying-api-keys

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5dfe76b and 29f89c1.

📒 Files selected for processing (2)
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx (5 hunks)
  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g., as any, as Type); instead validate values at runtime using zod schemas

Files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
apps/studio/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: use on prefix for prop callbacks and handle prefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
🧠 Learnings (4)
📚 Learning: 2025-12-11T17:04:40.002Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.002Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : When doing a mutation, always use the mutate function with onSuccess and onError callbacks that include toast.success and toast.error

Applied to files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
📚 Learning: 2025-12-11T17:04:40.002Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.002Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use mutateAsync only if the mutation is part of multiple async actions, wrapping the call with try/catch block and adding toast.success and toast.error

Applied to files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.

Applied to files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiUrl.tsx
  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
📚 Learning: 2025-12-11T16:46:03.665Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/e2e-testing.mdc:0-0
Timestamp: 2025-12-11T16:46:03.665Z
Learning: Applies to e2e/studio/**/*.{ts,spec.ts} : Dismiss toasts before interacting with UI elements as they can overlay buttons and block interactions

Applied to files:

  • apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx
⏰ 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). (3)
  • GitHub Check: typecheck
  • GitHub Check: test
  • GitHub Check: test (1)
🔇 Additional comments (1)
apps/studio/components/interfaces/App/CommandMenu/ApiKeys.tsx (1)

50-52: LGTM! Consistent toast implementation across all key types.

The toast notifications are implemented consistently for all API key types with clear, specific messages that distinguish between publishable, secret, anonymous, and service keys. The pattern correctly handles potential undefined values with the ?? '' operator.

Also applies to: 68-70, 87-89, 106-108

@github-actions

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  67 passed
skipped  4 skipped

Details

stats  71 tests across 12 suites
duration  7 minutes, 49 seconds
commit  29f89c1

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@joshenlim joshenlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified changes on staging preview!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants