mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(sidebar): stop Manual sort from mirroring sortEpoch into state In Manual mode the sort hook copied every sortEpoch bump into state from an effect, adding a nested React update per bump. A burst of store bumps at startup stacked those into 'Maximum update depth exceeded' (React #185). Manual now reads the live epoch directly; debounced modes are unchanged. * feat(sidebar): tell people when a drop switches sort to Manual Reordering by drag still switches the sidebar to Manual so the drop sticks, but it used to happen silently. Show a toast with a 'Back to <previous sort>' action; it retires itself on any later sort change so it can't override a newer choice. Drops while already in Manual stay silent. * feat(store): settle sortEpoch in the store instead of in React state Add settledSortEpoch plus a 3 s settle timer owned by a store listener installed in the state creator. Every write path (slice actions, the web session sync patch) goes through it, so the settled value stays correct with no sidebar mounted. Manual, a sort-mode switch, and a bump that changes the non-archived row count settle in the same notify; other bumps restart the window. A reset that lands settled clears the timer, and the disposer runs on HMR teardown. * fix(sidebar): read the settled sort epoch instead of mirroring it into state The sort hook no longer copies sortEpoch into React state from an effect in any mode; it reads the store's settledSortEpoch directly. That pattern added a nested update per bump and stacked into "Maximum update depth exceeded" (React #185) under flushSync bursts. Tests cover Manual, add/remove, burst reset, no-bump row changes, mode switch, and 80 flushSync bumps in Recent while worktrees are added. * cleaning up * fix(store): settle bumps when rows update during pending window Detect structural changes on worktreesByRepo updates in addition to sort epoch changes. When a row arrives without its own bump during a pending settlement window, the changed composition must still trigger settlement.