diff --git a/packages/sdk-components-animation/src/animate-children.tsx b/packages/sdk-components-animation/src/animate-children.tsx index ca5b0943e041..5662e2eb8da8 100644 --- a/packages/sdk-components-animation/src/animate-children.tsx +++ b/packages/sdk-components-animation/src/animate-children.tsx @@ -22,7 +22,10 @@ const namespace = "@webstudio-is/sdk-components-animation"; export const hooksAnimateChildren: Hook = { onNavigatorUnselect: (context, event) => { - if (event.instancePath[0].component === `${namespace}:${displayName}`) { + if ( + event.instancePath.length > 0 && + event.instancePath[0].component === `${namespace}:${displayName}` + ) { context.setMemoryProp( event.instancePath[0], animationCanPlayOnCanvasProperty, @@ -31,7 +34,10 @@ export const hooksAnimateChildren: Hook = { } }, onNavigatorSelect: (context, event) => { - if (event.instancePath[0].component === `${namespace}:${displayName}`) { + if ( + event.instancePath.length > 0 && + event.instancePath[0].component === `${namespace}:${displayName}` + ) { context.setMemoryProp( event.instancePath[0], animationCanPlayOnCanvasProperty,