Conversation
…bled queries, and sort order toggle
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request adds test coverage for localStorage persistence in the query devtools, verifying that sort key selections, mutation sort preferences, disabled query filtering, and sort order toggles are correctly persisted and retrieved from browser storage. ChangesDevtools Sort and Filter Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit c78c224
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx (1)
791-805: ⚡ Quick winTighten sort-order toggle assertion to expected values.
This currently only checks “value changed,” so it can pass with unexpected values. Consider asserting the allowed domain and exact opposite after the second click.
Suggested test assertion hardening
fireEvent.click(rendered.getByLabelText(/Sort order/)) const afterFirstToggle = localStorage.getItem( 'TanstackQueryDevtools.sortOrder', ) - expect(afterFirstToggle).not.toBeNull() + expect(['asc', 'desc']).toContain(afterFirstToggle) fireEvent.click(rendered.getByLabelText(/Sort order/)) const afterSecondToggle = localStorage.getItem( 'TanstackQueryDevtools.sortOrder', ) - expect(afterSecondToggle).not.toBe(afterFirstToggle) + expect(afterSecondToggle).toBe( + afterFirstToggle === 'asc' ? 'desc' : 'asc', + )🤖 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 `@packages/query-devtools/src/__tests__/Devtools.test.tsx` around lines 791 - 805, The test "should toggle the sort order when the sort order button is clicked" only asserts the localStorage value changed; update it to assert concrete allowed values and exact opposites: after clicking the button (via rendered.getByLabelText(/Sort order/)) read localStorage key 'TanstackQueryDevtools.sortOrder' and assert it is either 'asc' or 'desc' (not null), then click again and assert the new value equals the exact opposite string of the first ('asc' ↔ 'desc'); reference the render helper renderDevtools and the label text "Sort order" to locate the 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.
Nitpick comments:
In `@packages/query-devtools/src/__tests__/Devtools.test.tsx`:
- Around line 791-805: The test "should toggle the sort order when the sort
order button is clicked" only asserts the localStorage value changed; update it
to assert concrete allowed values and exact opposites: after clicking the button
(via rendered.getByLabelText(/Sort order/)) read localStorage key
'TanstackQueryDevtools.sortOrder' and assert it is either 'asc' or 'desc' (not
null), then click again and assert the new value equals the exact opposite
string of the first ('asc' ↔ 'desc'); reference the render helper renderDevtools
and the label text "Sort order" to locate the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 21f6b0eb-181f-4e85-8616-10e155c1280e
📒 Files selected for processing (1)
packages/query-devtools/src/__tests__/Devtools.test.tsx
size-limit report 📦
|
…nd '-1') across consecutive toggles
🎯 Changes
Add tests for the sort dropdown, the
hideDisabledQueriesfilter, and the sort order toggle in theDevtoolsbody component.sort by— sort dropdown and disabled-query filter:'TanstackQueryDevtools.sort'tolocalStoragewhen the queries-view sort dropdown is changed.'TanstackQueryDevtools.mutationSort'tolocalStoragewhen the mutations-view sort dropdown is changed.'TanstackQueryDevtools.hideDisabledQueries'is'true'.sort order— ascending/descending toggle:'TanstackQueryDevtools.sortOrder'and toggles its value across consecutive clicks of the sort order button.✅ Checklist
🚀 Release Impact
Summary by CodeRabbit