Skip to content

Commit

Permalink
Fix hook
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Feb 18, 2025
1 parent 01dc296 commit b00f452
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/sdk-components-animation/src/animate-children.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit b00f452

Please sign in to comment.