From 7ecc7911872c8041e135eff915a82dd2adfcd537 Mon Sep 17 00:00:00 2001 From: David Montero Date: Tue, 11 Aug 2026 05:19:26 +0200 Subject: [PATCH] fix(canvas): don't clobber a display's live ImageData with the persisted string Saved projects carry imageData: '' in the SSD1306's properties (the generated metadata lists it as a text prop). The property-sync effect assigned that string onto the web component, replacing the element's live ImageData and crashing wokwi-elements' firstUpdated with 'putImageData: parameter 1 is not of type ImageData' on every project load. Only a real ImageData may pass through now. --- frontend/src/components/DynamicComponent.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/components/DynamicComponent.tsx b/frontend/src/components/DynamicComponent.tsx index 29f54320..b6a0e501 100644 --- a/frontend/src/components/DynamicComponent.tsx +++ b/frontend/src/components/DynamicComponent.tsx @@ -382,6 +382,11 @@ export const DynamicComponent: React.FC = ({ Object.entries(properties).forEach(([key, value]) => { try { + // Display framebuffers round-trip through saved projects as strings + // ('' — the generated metadata lists imageData as a text prop). + // Assigning that string clobbers the element's live ImageData and + // crashes wokwi-elements' firstUpdated (putImageData TypeError). + if (key === 'imageData' && !(value instanceof ImageData)) return; let coerced: any = value; if (typeof value === 'string') { const def = metadata.defaultValues?.[key];