feat: add JSON export to Studio selection menu#1561
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
WalkthroughStudio 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 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify 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. Comment |
There was a problem hiding this comment.
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 winLoosened assertions in the JSON download test suggest unreset mock state between tests.
The CSV test (Lines 281, 291) asserts
mock.calls[0]andtoHaveBeenCalledTimes(1)exactly, while the JSON test right after it usesmock.calls.at(-1)(Line 312) andtoBeGreaterThanOrEqual(1)(Line 320). This asymmetry impliesURL.createObjectURL/clickspies aren't cleared betweenitblocks, so the JSON test's own call could be masked by accumulated calls from the prior test —toBeGreaterThanOrEqual(1)would still pass even ifclickweren't invoked in this test at all.Add
vi.restoreAllMocks()/vi.clearAllMocks()in abeforeEach/afterEachso 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
📒 Files selected for processing (6)
.changeset/pink-llamas-unite.mdFEATURES.mdui/studio/views/table/ActiveTableView.filtering.test.tsxui/studio/views/table/ActiveTableView.tsxui/studio/views/table/selection-export.test.tsui/studio/views/table/selection-export.ts
Closes #1560
Summary
copy jsonandsave jsonto the Studio selection export menuValidation
pnpm typecheckpnpm test -- ui/studio/views/table/selection-export.test.ts