fix(shape): persist stroke width / stroke color / fill across reload #70

Merged
AhmedHanafy725 merged 1 commit from development_fix_shape_style_persistence into development 2026-04-23 12:01:12 +00:00
Member

Summary

Shape style edits (Stroke Width, Stroke color, Fill color) from the Properties panel now persist across reload.

Closes #67

Root cause

The three Properties-panel handlers for prop-stroke-input, prop-fill-input, and prop-stroke-width mutated the Konva bg and redrew the layer but never called WhiteboardSync.onUpdate(currentNode). That call is what adds the node to pendingUpdates, triggers the debounce timer, and ultimately sends the object.update RPC. Without it the server never heard the edit, so object.list on reload returned the original style.

Changes

  • crates/hero_whiteboard_ui/static/web/js/whiteboard/properties.js — add WhiteboardSync.onUpdate(currentNode); inside each of the three shape style handlers, right after batchDraw(), matching the pattern already used by every other object-type style handler in the same file.

Preserved

  • Immediate local re-render and the ~500 ms debounce.
  • WebSocket broadcast to peers (applySyncUpdate already handled this path correctly; the fix just ensures it is actually triggered).
  • Undo/redo.
  • No schema or RPC changes — style.strokeWidth, style.stroke, style.fill were already in the wire format and round-trip through the reload path.

Out of scope (deserves a separate issue)

Two related persistence gaps were discovered while exploring the panel and are NOT fixed in this PR:

  • Frame title edit (prop-frame-title): rename is lost on reload.
  • Mindmap root text and color (prop-mm-root-text, prop-mm-root-color): edits lost on reload.

Test Results

  • cargo check --workspace: pass
  • cargo clippy --workspace -- -D warnings: pass
  • cargo fmt --check: pass

JS-only change; Rust checks confirm no regression. Manual QA required: set Stroke Width / Stroke / Fill on a shape, reload, confirm the new values are rendered back.

## Summary Shape style edits (Stroke Width, Stroke color, Fill color) from the Properties panel now persist across reload. ## Related Issue Closes https://forge.ourworld.tf/lhumina_code/hero_whiteboard/issues/67 ## Root cause The three Properties-panel handlers for `prop-stroke-input`, `prop-fill-input`, and `prop-stroke-width` mutated the Konva bg and redrew the layer but never called `WhiteboardSync.onUpdate(currentNode)`. That call is what adds the node to `pendingUpdates`, triggers the debounce timer, and ultimately sends the `object.update` RPC. Without it the server never heard the edit, so `object.list` on reload returned the original style. ## Changes - `crates/hero_whiteboard_ui/static/web/js/whiteboard/properties.js` — add `WhiteboardSync.onUpdate(currentNode);` inside each of the three shape style handlers, right after `batchDraw()`, matching the pattern already used by every other object-type style handler in the same file. ## Preserved - Immediate local re-render and the ~500 ms debounce. - WebSocket broadcast to peers (`applySyncUpdate` already handled this path correctly; the fix just ensures it is actually triggered). - Undo/redo. - No schema or RPC changes — `style.strokeWidth`, `style.stroke`, `style.fill` were already in the wire format and round-trip through the reload path. ## Out of scope (deserves a separate issue) Two related persistence gaps were discovered while exploring the panel and are NOT fixed in this PR: - Frame title edit (`prop-frame-title`): rename is lost on reload. - Mindmap root text and color (`prop-mm-root-text`, `prop-mm-root-color`): edits lost on reload. ## Test Results - `cargo check --workspace`: pass - `cargo clippy --workspace -- -D warnings`: pass - `cargo fmt --check`: pass JS-only change; Rust checks confirm no regression. Manual QA required: set Stroke Width / Stroke / Fill on a shape, reload, confirm the new values are rendered back.
fix(shape): persist stroke width / stroke color / fill across reload
All checks were successful
CI / build (pull_request) Successful in 2m17s
319977588d
The Properties-panel handlers for prop-stroke-input, prop-fill-input,
and prop-stroke-width mutated the Konva bg and redrew the layer but
never called WhiteboardSync.onUpdate. Without that call the server
never heard the edit, so reloading reset the shape to its pre-edit
style. Add the onUpdate call to each of the three handlers, matching
the pattern already used by every other object-type style handler in
the same file. No schema or RPC changes; style.strokeWidth, .stroke,
and .fill already round-trip through the existing wire format.

#67
AhmedHanafy725 merged commit 3c7ed0e0c0 into development 2026-04-23 12:01:12 +00:00
AhmedHanafy725 deleted branch development_fix_shape_style_persistence 2026-04-23 12:01:18 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_whiteboard!70
No description provided.