fix(canvas): Save button no-op due to leaked click event

The Toolbar and Sidebar Save buttons wired onClick={onSave} directly, so
React passed the MouseEvent as the first argument. handleSave treats its
first arg as a designIdOverride, corrupting design_id and making the save
fail silently. Ctrl+S worked because it calls handleSave() with no args.

Wrap both handlers as onClick={() => onSave()} so no event leaks through.

Add regression tests asserting onSave is called with zero arguments.

Fixes #186

ha-relevant: no
This commit is contained in:
Pouzor
2026-06-05 15:22:13 +02:00
parent 754a79d21f
commit ba2f6564ec
4 changed files with 70 additions and 2 deletions
+1 -1
View File
@@ -257,7 +257,7 @@ export function Sidebar({ onAddNode, onAddGroupRect, onAddText, onScan, onZigbee
icon={Save}
label="Save Canvas"
collapsed={collapsed}
onClick={onSave}
onClick={() => onSave()}
badge={hasUnsavedChanges}
accent
/>