Skip to content

test(app): cover manual sidebar order across host filter switches#2409

Open
Abeelha wants to merge 1 commit into
getpaseo:mainfrom
Abeelha:fix/sidebar-order-host-filter-reset
Open

test(app): cover manual sidebar order across host filter switches#2409
Abeelha wants to merge 1 commit into
getpaseo:mainfrom
Abeelha:fix/sidebar-order-host-filter-reset

Conversation

@Abeelha

@Abeelha Abeelha commented Jul 24, 2026

Copy link
Copy Markdown

While trying to reproduce #1871 I could not get the manual workspace order to reset on either current main or v0.1.103 (the version it was reported on). I went through the full pipeline: the sidebar order store, the reconcile effect in use-sidebar-workspaces-list, mergeWithRemainder on drag end, and the dnd-kit drag path. Every writer is either strictly additive or driven by a genuine drag event, and zustand's persist rehydration always resolves in favor of the persisted order, so none of them can clobber a saved custom order during filter switches.

Since this area had no coverage for the multi-host filter scenario, this PR adds it so the invariant stays locked:

  • packages/app/src/hooks/use-sidebar-workspaces-list.test.tsx: integration tests with two online hosts and real stores. Reorder while filtered to host A, switch to B and back (including the all-hosts intermediate), asserting both the resulting order and the persisted store contents. Also covers the pre-hydration write race explicitly.
  • packages/app/e2e/sidebar-host-filter-order.spec.ts: Playwright spec following the exact repro steps from bug: workspace manual order resets after switching sidebar host filter #1871 with a real mouse drag and host filter menu round trips.

All four existing sidebar-order suites still pass (33/33), oxlint and oxfmt are clean on the new files, and the app workspace typechecks.

One adjacent thing I noticed while auditing, separate from #1871: the reconcile effect computes setProjectOrder from the render-time persistedProjectOrder snapshot, so two simultaneously mounted instances of the hook could in theory revert each other's project-order write. Workspace orders are not affected (they are read fresh via getState()). Happy to follow up with a patch if that seems worth hardening.

Refs #1871

Regression coverage for the report in issue getpaseo#1871 (manual workspace order
resetting after switching the sidebar host filter). Adds:

- integration tests driving useSidebarWorkspacesList against the real
  zustand stores: reorder while filtered to one host, switch filters away
  and back (including the all-hosts intermediate state), and an explicit
  pre-hydration persist race where a reconcile write lands before
  AsyncStorage hydration resolves
- a browser e2e that follows the issue steps end to end with a real drag
  and the host filter menu

The reported reset could not be reproduced with these paths on current
main or on the reported v0.1.103; the suite pins the invariant so any
future regression in the order pipeline turns red.
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.

1 participant