feat: add navigation-safe frontend reorder coordinator and save-state UX - #995
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…rdinator UX Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…n seeding Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #979. Part of epic #975.
Summary
Replaces Browse's component-local reorder persistence with a navigation-safe coordinator (
frontend/src/tileOrdering.ts) owned aboveSortableTileGrid, plus a save-state indicator.TileOrderingCoordinator, module-level singleton): per-scope state machineidle → dirty → saving → (dirty-while-saving) → saved | conflict | error. Every accepted drag applies locally and is reported; drops during an active save are queued and coalesced to the newest snapshot — never discarded. Persists via the atomicPUT /api/tile-orderCAS contract from Implement an atomic, revisioned tile-order API with set-based updates #978, seeding the revision with a dedupedGETon first save (scope enterssavingduring seeding; seed failures emitfailedtelemetry).GET) instead of retrying stale membership forever. Failures keep the newest local intent retryable; success applies the authoritative response directly (no category-tree refresh) and never shows "saved" while newer local changes exist.claimGeneration) prevents an unmounted grid's callbacks from overwriting its replacement; abeforeunloadguard warns while unsaved order exists.ReorderStatusIndicator(Unsaved order / Saving order… / Order saved / Order changed elsewhere → Refresh / Could not save order → Retry) rendered above the Browse grid;useTileOrderingReact binding viauseSyncExternalStore.tileOrderingprop — coordinator mode applies drags locally and reports refs; legacy persistence untouched when absent (Manage Categories stays legacy until Migrate Manage Categories to the shared ordering workflow and complete end-to-end verification #982). No collision-detection changes.queued/coalesced/submitted/committed/conflicted/failedper the Add reorder operation correlation, timing, and diagnostic telemetry #977 contract.docs/tile-ordering.md.Testing
npm test: 88 files, 1358 passed (3 expected fail).tests/tileOrdering.test.ts(14 coordinator tests incl. queue-during-save, coalescing, unmount/remount survival, generation fencing, 409 and 400 conflict paths, seeding failure telemetry, 20 rapid reorders),tests/components/SortableTileGridCoordinator.test.tsx(4),tests/components/ReorderStatusIndicator.test.tsx(7).npm run lint,npm run build, prettier clean.Needs human verification
Link to Devin session: https://app.devin.ai/sessions/414754bd88374dc693f47100ac269e78