fix(canvas): guard the mount-time property loop against the persisted imageData string too
c201f5d9 guarded the property-sync effect, but the mount effect has its own raw Object.entries(properties) loop that runs first and assigned the saved imageData: '' onto the fresh element — so the firstUpdated putImageData crash survived. Same guard, second call site.
This commit is contained in:
parent
7ecc791187
commit
8f7b878149
|
|
@ -623,6 +623,10 @@ export const DynamicComponent: React.FC<DynamicComponentProps> = ({
|
|||
// Set initial properties
|
||||
Object.entries(properties).forEach(([key, value]) => {
|
||||
try {
|
||||
// Same guard as the property-sync effect above: the persisted
|
||||
// imageData string must never replace the element's live ImageData
|
||||
// (it crashes wokwi-elements' firstUpdated on mount).
|
||||
if (key === 'imageData' && !(value instanceof ImageData)) return;
|
||||
(element as any)[key] = value;
|
||||
} catch (error) {
|
||||
console.warn(`Failed to set initial property ${key}:`, error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue