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.
This commit is contained in:
parent
49ac373068
commit
7ecc791187
|
|
@ -382,6 +382,11 @@ export const DynamicComponent: React.FC<DynamicComponentProps> = ({
|
|||
|
||||
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];
|
||||
|
|
|
|||
Loading…
Reference in New Issue