5.7 KiB
CRITICAL BUG FIXES - Properties Panel Issues
Bugs Found and Fixed
Bug #1: Color/Properties Changes Not Showing
Symptom: Changed color in palette → no change in form; changed text → no change in form
Root Cause: After clicking "Apply Changes", the code called updatePropertiesPanel({ silent: true }) which ONLY updates X/Y position values in the existing form. It does NOT rebuild the form with new values from other properties (color, text, etc).
Solution: Changed to call updatePropertiesPanel() WITHOUT silent: true after applying changes, so the entire form rebuilds with updated values.
Line Changed: Line ~1118 in builder.js
Before:
updatePropertiesPanel({ silent: true }); // Only updates X/Y
After:
updatePropertiesPanel(); // Rebuilds entire form with new values
Bug #2: Text Input Reverts While Typing
Symptom: Start typing in text field → text keeps reverting/disappearing
Root Cause: Every 5 seconds, the device sends a status:update event. The builder was listening to this event and calling updatePropertiesPanel() WITHOUT silent: true. This meant every 5 seconds, the entire properties form was being REBUILT, clearing any text the user was in the middle of typing!
Solution: Removed the automatic property panel update on status events. The status update is for dashboard refresh, not builder properties.
Lines Changed: Lines ~51-58 in builder.js
Before:
document.addEventListener('status:update', () => {
if (document.getElementById('live-preview')?.checked) {
renderPreview();
}
updatePropertiesPanel(); // ← This rebuilds form every 5 seconds!
});
After:
document.addEventListener('status:update', () => {
if (document.getElementById('live-preview')?.checked) {
renderPreview();
}
// Don't update properties on every status event - it can clear user input!
// Only minimal updates needed for live preview, not properties panel
});
What This Means
✅ Color picker now works - Change color → Apply → Form updates with new color ✓
✅ Position changes now work - Change X/Y → Apply → Form updates with new position ✓
✅ Text input no longer reverts - Type text → won't be cleared by status updates ✓
✅ All properties persist - After Apply, changes saved to device after 800ms ✓
Testing Instructions
Test 1: Change Color
- Select any element with a color property
- Click the color input box
- Choose a different color
- Click "Apply Changes"
- Expected: Color input should show your new color choice
- Refresh browser page
- Expected: Element should still have new color
Test 2: Change Text
- Select a Text/Label element
- Click the text input field
- Type some new text
- Expected: Text should stay in input box, not revert
- Click "Apply Changes"
- Expected: Text input stays filled with your text (doesn't get cleared)
- Click canvas to deselect, then reselect element
- Expected: Text input shows your new text
Test 3: Change Position
- Select any element
- Click X position input
- Change the value
- Click "Apply Changes"
- Expected: X input shows your new value
- Check canvas - element should have moved to new X position
Test 4: Rapid Edits
- Select a button element
- Change text field
- Change color field
- Change position X
- Change position Y
- Change font size (if applicable)
- Expected: None of these should revert or get cleared
- Click "Apply Changes" once
- Expected: All changes apply at once
- Refresh browser
- Expected: All changes persisted to device
Test 5: Live Editing + Status Updates
- Select an element
- Start editing properties
- Expected: Every 5 seconds when status updates come in, your form should NOT be cleared
- Keep typing/editing through multiple status update intervals
- Expected: No interruptions, no text loss
Technical Details
Why These Bugs Happened
-
silent: truemisuse: The code usedsilent: trueto avoid full rebuilds during drags (good for performance). But it was ALSO used after Apply, which meant changes to non-position properties were invisible. -
Status event misuse: The builder was listening to general
status:updateevents meant for dashboard refresh, and using them to rebuild properties panel. This was unnecessary and destructive.
How It's Fixed
- After Apply: Always rebuild the form completely so all property changes are visible
- During Drag: Still use
silent: truefor performance (only update X/Y) - On Status Update: Don't touch the properties panel - it's not needed for the live preview functionality
Performance Impact
- ✅ No negative impact
- ✅ Drag operations still efficient (silent updates for X/Y)
- ✅ Apply operations now slightly slower (rebuild form) but necessary for correctness
- ✅ Status updates no longer cause unnecessary form rebuilds
Files Modified
data/js/builder.js- Line 58: Changed to remove automatic property update on status events
- Line 1118: Changed to always rebuild properties panel after Apply
Root Cause Summary
This was a classic case of feature interactions causing bugs:
- Feature 1: Silent updates during drag (good for performance)
- Feature 2: Status polling (needed for dashboard)
- Feature 3: Form rebuilding on status (thought to refresh all UI)
- Bug: Feature 3 was interacting with feature 1, causing confusion about when to use
silent: true - Result: Properties appeared not to change, text was cleared mid-edit
- Solution: Remove unnecessary feature 3, keep features 1&2 focused on their purpose