Repository navigation
fix(reorder): serialize structural mutations to stop drag&drop reverts - #1
Merged
Merged
Conversation
Concurrent reorder/duplicate/create/delete requests each did an unserialized read-modify-write of a sibling set's previewPosition, so two overlapping requests lost-updated each other: a drag looked applied (the in-place move runs only after the server confirms) but snapped back to its old slot after reload — intermittent, and worse on large pages where slower requests widen the overlap window. Funnel every structural mutation through a single in-flight slot: _jsonRequest now chains onto _mutationQueue and delegates the real fetch to _performJsonRequest, so at most one mutation runs at a time, in submission order. A failed request releases the slot instead of wedging the queue. Also fix the cross-column block move: it reindexed the source column from the collection's published-position order (#[OrderBy(['position'])]) rather than previewPosition, reverting the draft order of the blocks left behind. usort by previewPosition first, mirroring the target branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Klehm
added a commit
that referenced
this pull request
Jul 29, 2026
fix(reorder): serialize structural mutations to stop drag&drop reverts
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.
Problème
Sur des pages chargées, certains déplacements en drag & drop semblaient appliqués visuellement mais n'étaient pas enregistrés : après reload, l'élément revenait à sa place initiale. Intermittent, non reproductible à la demande, plus fréquent sur les grosses pages.
Diagnostic
Le déplacement visuel n'est pas optimiste : le nœud ne bouge qu'après confirmation serveur (
moved:true→cb:*:reorder:apply). Donc un move visible = unflush()réussi, puis écrasé.Cause racine — lost update concurrent. Côté client,
_jsonRequesttirait lesfetchsans sérialisation ; côté serveur, chaque reorder fait un read-modify-write non verrouillé de tout le jeu de frères (previewPosition). Deux drags rapprochés → la 2ᵉ requête lit l'état pré-commit de la 1ʳᵉ, et le derniercommitécrase l'autre. D'où l'intermittence et le « pire sur grosses pages » (requêtes plus lentes ⇒ fenêtre de chevauchement plus large).Bug secondaire déterministe. Le move de bloc inter-colonnes ré-indexait la colonne source dans l'ordre
#[OrderBy(['position'])](position publiée) au lieu depreviewPosition→ revert de l'ordre draft des blocs restants.Correctif
_jsonRequestenchaîne sur_mutationQueueet délègue le fetch à_performJsonRequest⇒ au plus une mutation en vol, en ordre de soumission ; un échec libère le créneau sans bloquer la file.previewPositionavantreindexPreviewde la colonne source, en miroir du chemin cible.Tests
Note
Couvre l'éditeur unique (un draft, un onglet). Pour du multi-onglet/multi-éditeur, un verrou optimiste (
versionsurContentArea) pourrait être ajouté ultérieurement.🤖 Generated with Claude Code