Repository navigation
feat(app): reorder dashboard filters with up/down controls - #3876
Conversation
Co-authored-by: Drew Davis <pulpdrew@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 79a5540 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| }); | ||
| }; | ||
|
|
||
| const handleReorderFilter = (fromIndex: number, toIndex: number) => { |
There was a problem hiding this comment.
🟡 P2 — Reorder is computed from stale dashboard data, so quick repeated clicks overwrite each other on saved dashboards
On a saved dashboard, setDashboard sends a PATCH and only updates the list when the ['dashboards'] refetch comes back (packages/app/src/dashboard.ts:159-187, 279-319). Nothing updates the list in the meantime, so the rows keep their old order and the chevrons stay clickable. Each click builds a full filters array from the old order and replaces the saved one. Example: starting from [A,B,C], clicking 'down' on A twice quickly sends [B,A,C] both times, so A moves one place instead of two. Clicking A down and then C up quickly sends [A,C,B] last, which throws away A's move. The PATCHes can also arrive out of order. The E2E spec works around this by polling between moves. Fix: disable the reorder buttons while isLoading (which already reflects isSavingDashboard || isFetchingDashboard), or update the ['dashboards'] cache optimistically in onMutate.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Fixed in 79a5540. The reorder chevrons are now disabled while a save is in flight (isLoading = isSavingDashboard || isFetchingDashboard), so a second click can't fire until the list reflects the first move's new order. Added a unit test for the disabled-while-saving state. I went with disabling rather than an optimistic onMutate to keep the change out of dashboard.ts, which this PR doesn't otherwise touch.
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 2 P3 No inline comments. 2 P3 folded at the bottom. 🔵 2 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. The change is a well-contained, UI-only reorder affordance gated behind an optional 🟡 P2 -- recommended
🔵 P3 nitpicks (7)
Reviewers (9): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, previous-comments, ce-agent-native-reviewer, ce-learnings-researcher. Prior comments: The three earlier Bugbot comments (arrayMove adoption, disable-while-saving race, ActionIcon vs UnstyledButton) are confirmed addressed or explicitly declined; no prior feedback is left unresolved. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3075b9e. Configure here.
E2E Test Results✅ All tests passed • 488 passed • 1 skipped • 1105s
Tests ran across 4 shards in parallel. |
Co-authored-by: Drew Davis <pulpdrew@gmail.com>
|
Re the P3s:
|

Summary
Dashboard filters and variables are stored as an ordered list, and that order drives both the edit-filters modal list and the on-page filter bar — but until now there was no way to change it. This adds up/down controls to each row in the "Filters and Variables" modal so a user can move a filter earlier or later. The control at an end (up on the first, down on the last) is disabled.
Reordering permutes the dashboard's existing
filtersarray, so no schema change is needed and the new order is persisted and reflected everywhere the filters render.Scope: the main dashboard (
DBDashboardPage), where variables live. The controls are gated behind an optionalonReorderprop, so the Services preset dashboard — whose filters are persisted individually server-side with no array order, and which renders withshowVariableOptions=false— simply doesn't show them.Screenshots or video
How to reproduce
Starting point: full-stack
yarn dev(the reorder saves through the dashboard update API).On
main:On this branch:
How to test on Vercel preview
N/A — the reorder persists through the dashboard update API, which the LOCAL_MODE preview does not run.
References
Resolves HDX-6240
Testing
DashboardFiltersModal.test.tsx(move up/down by index, ends disabled, controls hidden without a handler).dashboard-filter-reorder.spec.ts(full-stack): creates three filters, moves one down and another up, confirms the order persists across a reload.yarn lint:fixandyarn tsc --noEmitclean.Fixes HDX-6240
Note
Low Risk
UI-only reorder of the existing filters array with no auth, schema, or query-logic changes; gated behind an optional callback for surfaces that don’t support ordered filter lists.
Reviewed by Cursor Bugbot for commit 79a5540. Bugbot is set up for automated code reviews on this repo. Configure here.