feat: add JSON export to Studio selection menu - #1561
SouhailKrs wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 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 Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to JSON exports from tables with back-relation columns can omit displayed relational data. The issue is localized but should be corrected before relying on exports for those tables. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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