Repository navigation
fix(studio): prevent truncation of large values in copy/export operations - #42818
4RH1T3CT0R7 wants to merge 3 commits into
Conversation
…ions The Table Editor grid truncates large column values (JSONB, text, etc.) at 10KB for display performance. This truncation was leaking into copy-to-clipboard and file export operations, causing data loss. Add `fetchSelectedTableRows()` that re-fetches specific rows by primary key using `SELECT *` (no truncation CTE). Copy and export operations now use this function to get full data before formatting output. Changes: - Add `fetchSelectedTableRows` to re-fetch rows without truncation - Add `fetch_selected` export type for selected-row file exports - Update Header copy/export to fetch full data before output - Update RowContextMenu to fetch full cell/row data before copying - Use promise-based `copyToClipboard` pattern for Safari compatibility Fixes supabase#37151 Fixes supabase#42289
|
@4RH1T3CT0R7 is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughIntroduced asynchronous data enrichment for copy and export operations by adding a Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Grid UI<br/>(Header/Menu)
participant Client as Client Logic<br/>(onCopyRows)
participant API as Supabase API
participant DB as Database
participant Clipboard as Clipboard
UI->>Client: User clicks Copy Rows
Client->>Client: Guard check: project exists?
Client->>API: fetchSelectedTableRows(projectRef,<br/>selectedRows, filters, sorts)
API->>DB: Query rows by PK with<br/>impersonation state
DB-->>API: Full row data (no truncation)
API-->>Client: Row[] Promise
Client->>Client: Format rows to CSV/SQL/JSON
Client->>Client: Create textPromise
Client->>Clipboard: copyToClipboard(textPromise)
Clipboard-->>Client: Copy complete
Client->>UI: Show success toast
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
|
@4RH1T3CT0R7 I believe there are a couple prettier errors blocking this from getting merged: [warn] apps/studio/components/grid/components/header/Header.tsx
[warn] apps/studio/components/grid/components/header/HeaderNew.tsxWe just hit this export truncation bug in our org, caused a lot of suprising issues because we assumed an export would be complete, almost lost some important data! |
Remove unnecessary parentheses in exportParams object literal to satisfy prettier formatting rules.
|
@pirate Fixed! Ran |
|
@awaseem perhaps you may be able to help authorize this PR? (sorry if you're the wrong person to ping) |
|
any updates? |
Summary
fetchSelectedTableRows()that re-fetches specific rows by primary key usingSELECT *(no truncation CTE) before copy/exportWhat changed
apps/studio/data/table-rows/table-rows-query.tsfetchSelectedTableRowsfunctionapps/studio/components/layouts/TableEditorLayout/ExportAllRows.tsxfetch_selectedexport type + handlingapps/studio/components/grid/components/header/Header.tsxfetch_selectedfor export, fetch full data for copyapps/studio/components/grid/components/header/HeaderNew.tsxapps/studio/components/grid/components/menu/RowContextMenu.tsxAffected operations
Design decisions
copyToClipboard(Promise<string>)pattern instead ofawait-then-copy, satisfying theno-await-before-copy-to-clipboardlint rulefetchAllTableRowswith current filters (same limitation as the existing "Load" button)inTupleFilterSqlwhich produces(col1, col2) IN ((v1, v2), ...)[]immediately if no rows are selected, preventing invalid SQLTest plan
pnpm typecheck- confirmed)pnpm lint- confirmed)Fixes #37151
Fixes #42289
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes