Bug: AdminCategoriesFacade.reorder(id, targetOrder) took the target
row's numeric order and wrote it straight onto the dragged category
(order: targetOrder). That leaves two siblings tied on the same order
value instead of actually repositioning the dragged item - and since
the local gateway's list sort (Array.prototype.sort, stable) breaks
ties by original array position, drops in certain directions have no
visible effect at all. All seeded categories additionally start at
order: 0 (AdminCategoriesLocalGateway.toAdminCategory), so on fresh
data literally every drag silently no-ops.
Fix: reorder(id, targetId) now takes the target category's id (not
its order value, which can be ambiguous/duplicated), computes the
full sibling sequence with the dragged item spliced into the target's
position, and persists sequential 0..n-1 order values for every
sibling whose order actually changed. Restricted to same-parent
siblings (dragged.parentId !== target.parentId is a no-op, matching
the tree UI's existing scope - no cross-parent move support).
Updated the drag payload end to end: AdminCategoriesListComponent's
`reorder` output now emits { id, targetId } instead of
{ id, targetOrder }; the list page binding follows.
Verified live via window.ng.getComponent() on
/ru/backoffice/categories (devBypassAdmin=true; real backend
unreachable in this environment, so verified against
facade.categories.set([...]) synthetic siblings, consistent with the
gateway calls the facade actually issues):
- Before fix: 3 siblings order 0/1/2, drag 'c' onto 'a' ->
gateway.updateCategory received only { id: 'c', order: 0 }, tying
'a' and 'c' at order 0 (with 0-order seed data, no siblings ever
become distinguishable at all).
- After fix: same drag -> gateway.updateCategory called for 'c', 'a',
'b' with the correct distinct sequence (c:0, a:1, b:2).