Whiteboard: selection-toolbar property edits bypass history, double-fire onUpdate, and batchDraw inconsistently #184
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#184
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A. Property edits bypass history
Every picker handler in
static/web/js/whiteboard/selection_toolbar.js— sticky color / font size / text color / alignment, text font/size/color/align, shape stroke/fill/strokeWidth/text-color/font-size/align, drawing stroke/width, frame title, kanban title / column color / add column / add card, mindmap title / direction / tree color, group name, webframe URL — callsWhiteboardSync.onUpdate(node)directly with noWhiteboardHistory.snapshotBefore+commitUpdate. Ctrl+Z does nothing for property changes.B. Double
onUpdateper mutationPaths that call
rerenderSticky/Text/Shape/Documentalso callWhiteboardSync.onUpdate(node)themselves. The rerender helpers already callonUpdateinternally — every slider tick fires two RPCs.C. Inconsistent
batchDraw()Some handlers
batchDrawdirectly; some delegate viarerenderXxx; some omit both. Pattern is muddled.Approach
Add a
persistToolbarMutation(node)helper (commitUpdate + onUpdate). Two patterns:rerenderXxx:snapshotBefore→ mutate →rerenderXxx(batchDraw + onUpdate baked in) →commitUpdate.snapshotBefore→ mutate →batchDraw→persistToolbarMutation.Drop duplicate
WhiteboardSync.onUpdatefrom rerenderXxx paths.Acceptance
onUpdatefires once per slider tick / picker click.batchDrawsemantics consistent (one call per handler).Test Results + Final Summary
Changes
static/web/js/whiteboard/selection_toolbar.js:persistToolbarMutation(node)helper (commitUpdate + onUpdate).snapshotBefore+ eitherpersistToolbarMutation(Pattern B: manual mutation + explicit batchDraw) orcommitUpdatealone (Pattern A: paths that useWhiteboardObjects.rerenderXxx, which already emitonUpdateandbatchDrawinternally).WhiteboardSync.onUpdate(node)in Pattern A paths.WhiteboardWebframe.applyNewUrl(node, v)instead ofupdateUrl, so it inherits the history bracket added in #183 and the embeddable-check path.Handlers wrapped
applyNewUrlfor history).Left intentionally alone
snapshotBefore+commitUpdate+onUpdatefrom #183 — equivalent to the new helper).WhiteboardCalendar.navigatePrev/Nextwhich handle their own history).WhiteboardFrames.moveFrameUp/Down— separate audit item #14).WhiteboardKanban.addCardToFirstColumn— history from #182).WhiteboardMindmapfunctions — history from #183).Behaviour after fix
commitUpdateno-ops on identical before/after).onUpdatefires exactly once per slider tick / picker click.batchDrawsemantics are consistent: eitherrerenderXxxhandles it, or the manual handler calls it once beforepersistToolbarMutation.Gates
node -c selection_toolbar.js— JS syntax OKcargo fmt --check— passcargo clippy --workspace --all-targets -- -D warnings— passcargo test --workspace --lib— 0 tests, 0 failuresManual verification still required
Rebuild + restart
hero_whiteboard_admin, hard-reload. For each object type, select it on a board and walk through every picker; confirm Ctrl+Z reverses each change.