Skip to content

fix(wheel): re-render mirror after pin order commit - #16

Merged
Haaaiawd merged 2 commits into
masterfrom
fix/wheel-drag-commit-no-refresh
Oct 7, 2026
Merged

Haaaiawd merged 2 commits into
masterfrom
fix/wheel-drag-commit-no-refresh

Conversation

@Haaaiawd

@Haaaiawd Haaaiawd commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause of "commits but mirror never updates": pinOrder() in src/js/store.js required inject_order > 0 and mapped anything else to the 9999 tail sentinel. The commit chain itself was intact (set_pin_order → flip wheelSort to manual → loadPrompts/rebuildIndex/renderPrompts → renderWheelMirror), but a committed position of 0 — e.g. a 0-based write, or a pack-authored sort weight of "0" (inject_order is user-facing pack data, see GUI_RENOVATION_GUIDE.md) — silently sorted to the tail, so the re-rendered mirror showed the old order.
  • Fix: any finite inject_order is now honored as an explicit position; only missing/unparseable values get the sentinel.
  • Rollback was already correct by construction (verified live): the dragged row keeps its DOM slot while position:fixed, the .wm-insert marker is removed and the row restored on drop before commit — a rejected set_pin_order leaves the pre-drag order intact.
  • e2e hardening in tests/e2e/wheel_sort_drag_e2e.py: durable localStorage-backed mock (set_pin_order writes 1-based strings exactly like Rust (i+1).to_string()); post-drop asserts submitted ids == rendered DOM order (pointer + keyboard paths); real page.reload() persistence check (the old check claimed "after reload" but never reloaded); rejected-commit rollback case; inject_order "0" ranks-first regression guard; DOM-order waits report named FAILs instead of crashing on timeout.

Verified

  • User's Linux smoke repro (unchanged, 0-based mock): 16/17 → 17/17 against this branch.
  • wheel_sort_drag_e2e.py: 26/26 PASS. Negative proofs: refresh chain removed → 5 named FAILs; pinOrder reverted → '0' ranks first FAIL.
  • hotkey_status_e2e 10/10, hotkey_recorder_e2e 22/22, no_tauri_e2e 13/13 — no regressions.
  • Mouse drag from row body works (by design — only touch/pen requires the .drag grip); grip has cursor:grab + hover reveal in styles.css.

Test plan

  • python3 tests/e2e/wheel_sort_drag_e2e.py — ALL PASS locally
  • Full local e2e suite green
  • CI green

Generated with Devin

haa and others added 2 commits October 7, 2026 09:03
pinOrder() treated inject_order <= 0 as "unordered" (sentinel 9999), so a
committed write of position 0 — a 0-based writer or a pack-authored weight
of "0" (inject_order is user-facing pack data per GUI_RENOVATION_GUIDE) —
silently sorted to the tail. The commit chain itself was sound:
set_pin_order persists, wheelSort flips to manual, and
loadPrompts+rebuildIndex+renderPrompts re-renders #wheelMirror — but the
fresh sort mapped the new first item to the tail, so the DOM appeared to
never update. Any finite inject_order is an explicit position now.

Strengthen wheel_sort_drag_e2e so this class of bug cannot pass again:
mock backend is durable (localStorage-backed, 1-based writes matching
Rust), post-drop asserts submitted ids == rendered DOM order for pointer
and keyboard commits, a rejected commit must roll back the visual order
with no mid-state residue, the committed order must survive page.reload(),
and inject_order "0" must rank first not last. Verified: reverting the
refresh chain FAILs the new DOM-order checks; reverting pinOrder FAILs
the "0" check.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Haaaiawd
Haaaiawd force-pushed the fix/wheel-drag-commit-no-refresh branch from 1dafe2d to ffa60cc Compare October 7, 2026 07:31
@Haaaiawd
Haaaiawd merged commit a684f37 into master Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant