selection: install resize pointer listeners once#49
Merged
Conversation
The edit-state was a defonce #js {} accessed via unchecked-get/set —
a second state cell outside app-state, invisible to devtools and
indistinguishable from PLOP. Promotes it to a defonce atom holding a
Clojure map; live DOM element refs ride in the map values. The
serializable slice (:text-editing-id) is still mirrored to
state/app-state under :ui, unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
start-resize! attached pointermove / pointerup on every drag and finish-resize! removed them — that worked but meant the listeners were churned per gesture, and a missed cleanup (hot reload, exception) would silently leak handlers. The pattern mirrors dnd/drag.cljs already: install once at mount, the handlers themselves early-exit on resize-active? until a drag begins. No behaviour change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This reverts commit 95a8b45.
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.
Summary
Single behaviour-preserving refactor from the audit's lowest-risk findings.
Inline-edit change reverted
This branch originally also contained an `inline-edit` refactor that converted its `defonce #js {}` cell to a Clojure atom. That change failed the manual smoke test ("text disappears after Esc / blur"). It is reverted on this branch — see commits `95a8b45` (original) and `c3f2750` (revert) for the audit trail. Suspected cause is the `defonce` hot-reload trap (the var is bound to the old JS-object shape when the dev server reloads the new file, so `@edit-state` runs against a JS object), but until that is confirmed with a deterministic reproduction I'd rather not re-land this piece. The selection change is independent and unaffected.
Test plan
🤖 Generated with Claude Code