feat: prevent stale refresh overwrites and add ordering conflict recovery - #996
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
Conversation
…very 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:
|
21 tasks
…g owned by visible loads 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 #980. Part of epic #975. Stacked on #995.
Summary
Makes Browse's category/uncategorized-image reads stale-proof and gives ordering conflicts a deliberate resolution path.
useBrowseData): every category-tree and uncategorized-image read claims a generation (categoriesReadGen/uncategorizedReadGen); only the newest read may commit state, so a slow older response (foreground or background) can never overwrite newer data regardless of completion order. A separatevisibleCategoriesLoadGen(claimed only by non-silent loads) owns the loading flag, so a silent poll finishing later cannot strand the spinner.refreshCategories/refreshUncategorizedImages) abort the previous read for the same data via per-dataAbortControllers;AbortErroris treated as expected control flow — superseded refreshes resolve with the freshest committed data (mirrored via refs) instead of rejecting, so no false "Could not refresh" warnings or unhandled rejections.tileOrderingCoordinator.hasUnsavedChanges()(dirty / saving / queued / conflicted / awaiting retry), so a polling response can never replace local pending order; polling resumes on the next tick once clean.ReorderStatusIndicator— existing Refresh (acceptServerOrder) plus new Keep my order (TileOrderingCoordinator.reapplyLocalOrder), which resubmits the newest local intent against the authoritative revision from the conflict body. Never silent last-write-wins.GET /api/tile-orderfor the affected scope; successful reorders still avoid full-tree reloads (from feat: add navigation-safe frontend reorder coordinator and save-state UX #995).docs/tile-ordering.md.Testing
tests/useBrowseData.test.ts: older response cannot overwrite newer (categories + images), foreground load aborts prior read and its response is discarded, superseded refresh resolves with freshest committed data, silent read cannot strand the visible spinner, aborts are control flow (no console error), polling pauses while unsaved and resumes after resolution.reapplyLocalOrderre-PUTs the newest local intent with the conflict revision; new indicator test for "Keep my order".npm run buildclean.npm run linthas one pre-existing error insrc/components/CanvasOverlay.tsx(react-refresh/only-export-components, introduced by fix: correct Fabric text box resizing #984 on main) — present on the base branch, untouched here.Needs human verification
Link to Devin session: https://app.devin.ai/sessions/414754bd88374dc693f47100ac269e78