Skip to content

Commit b00f452

Browse files
committed
Fix hook
1 parent 01dc296 commit b00f452

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/sdk-components-animation/src/animate-children.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ const namespace = "@webstudio-is/sdk-components-animation";
2222

2323
export const hooksAnimateChildren: Hook = {
2424
onNavigatorUnselect: (context, event) => {
25-
if (event.instancePath[0].component === `${namespace}:${displayName}`) {
25+
if (
26+
event.instancePath.length > 0 &&
27+
event.instancePath[0].component === `${namespace}:${displayName}`
28+
) {
2629
context.setMemoryProp(
2730
event.instancePath[0],
2831
animationCanPlayOnCanvasProperty,
@@ -31,7 +34,10 @@ export const hooksAnimateChildren: Hook = {
3134
}
3235
},
3336
onNavigatorSelect: (context, event) => {
34-
if (event.instancePath[0].component === `${namespace}:${displayName}`) {
37+
if (
38+
event.instancePath.length > 0 &&
39+
event.instancePath[0].component === `${namespace}:${displayName}`
40+
) {
3541
context.setMemoryProp(
3642
event.instancePath[0],
3743
animationCanPlayOnCanvasProperty,

0 commit comments

Comments
 (0)