Skip to content

feat: add JSON export to Studio selection menu#1561

Open
SouhailKrs wants to merge 2 commits into
prisma:mainfrom
SouhailKrs:feat/add-json-row-export
Open

feat: add JSON export to Studio selection menu#1561
SouhailKrs wants to merge 2 commits into
prisma:mainfrom
SouhailKrs:feat/add-json-row-export

Conversation

@SouhailKrs

Copy link
Copy Markdown

Closes #1560

Summary

  • add copy json and save json to the Studio selection export menu
  • preserve JSON values as real JSON types instead of stringifying everything
  • export a single selected row as one object instead of a one-item array

Validation

  • pnpm typecheck
  • pnpm test -- ui/studio/views/table/selection-export.test.ts
  • validated in local demo

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 24c0a0c5-129f-4867-a558-ed3e82f09cd2

📥 Commits

Reviewing files that changed from the base of the PR and between e0ce064 and 9a0b461.

📒 Files selected for processing (1)
  • ui/studio/views/table/selection-export.test.ts

Summary by CodeRabbit

  • New Features

    • Added JSON export options for selected rows and cell ranges.
    • Copy selections as JSON to the clipboard or save them as .json files.
    • JSON exports preserve visible columns, current column order, and pinned-column layout.
    • Multi-row selections export as arrays; single-row selections export as objects.
  • Documentation

    • Updated selection export documentation to include JSON support and its formatting behavior.

Walkthrough

Studio table selection exports now support JSON for clipboard copying and file downloads. JSON output uses visible column IDs as object keys, preserves nested values, normalizes unsupported values such as bigint and undefined, and emits single objects or arrays based on row count. The export menu, filenames, MIME types, tests, feature documentation, and release changeset were updated accordingly.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Most requirements are met, but the implementation exports a single selected row as an object instead of the issue's array-of-objects format. Return JSON arrays of objects for all selections, including single-row selections, or update the issue spec if the new shape is intended.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Clear and specific; it matches the main change of adding JSON export to the Studio selection menu.
Description check ✅ Passed The description is directly related and accurately summarizes the JSON export additions and tests.
Out of Scope Changes check ✅ Passed All changes relate to JSON selection export, tests, docs, and release notes; no unrelated code paths were introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

@SouhailKrs SouhailKrs changed the title fear: Add JSON export to Studio selection menu feat: Add JSON export to Studio selection menu Jul 19, 2026
@SouhailKrs SouhailKrs changed the title feat: Add JSON export to Studio selection menu feat: add JSON export to Studio selection menu Jul 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/studio/views/table/selection-export.test.ts (1)

264-322: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Loosened assertions in the JSON download test suggest unreset mock state between tests.

The CSV test (Lines 281, 291) asserts mock.calls[0] and toHaveBeenCalledTimes(1) exactly, while the JSON test right after it uses mock.calls.at(-1) (Line 312) and toBeGreaterThanOrEqual(1) (Line 320). This asymmetry implies URL.createObjectURL/click spies aren't cleared between it blocks, so the JSON test's own call could be masked by accumulated calls from the prior test — toBeGreaterThanOrEqual(1) would still pass even if click weren't invoked in this test at all.

Add vi.restoreAllMocks()/vi.clearAllMocks() in a beforeEach/afterEach so both tests can use precise, order-independent assertions (toHaveBeenCalledTimes(1), mock.calls[0]).

🤖 Prompt for 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.

In `@ui/studio/views/table/selection-export.test.ts` around lines 264 - 322, Reset
the URL and anchor spies between tests in the selection export test suite using
an appropriate beforeEach or afterEach cleanup. Then tighten the JSON download
test to inspect its single call directly with mock.calls[0] and assert
createObjectURL and click were each called exactly once, matching the precise
assertions in the CSV test.
🤖 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.

Outside diff comments:
In `@ui/studio/views/table/selection-export.test.ts`:
- Around line 264-322: Reset the URL and anchor spies between tests in the
selection export test suite using an appropriate beforeEach or afterEach
cleanup. Then tighten the JSON download test to inspect its single call directly
with mock.calls[0] and assert createObjectURL and click were each called exactly
once, matching the precise assertions in the CSV test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: aaf194e9-d7cc-4ee4-badb-0a6f6ec7907a

📥 Commits

Reviewing files that changed from the base of the PR and between 550f51d and e0ce064.

📒 Files selected for processing (6)
  • .changeset/pink-llamas-unite.md
  • FEATURES.md
  • ui/studio/views/table/ActiveTableView.filtering.test.tsx
  • ui/studio/views/table/ActiveTableView.tsx
  • ui/studio/views/table/selection-export.test.ts
  • ui/studio/views/table/selection-export.ts

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.

Add "Copy JSON" / "Save JSON" option to row selection export menu in Prisma Studio

1 participant