Skip to content

Commit

Permalink
fix: safely remove helpers in vDistanceTo and vLightHelper directives
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Feb 5, 2025
1 parent a75af34 commit c505179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/directives/vDistanceTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const vDistanceTo = {
},
unmounted: (el: TresObject) => {
arrowHelper?.dispose()
el.parent.remove(arrowHelper)
if (el.parent) {
el.parent.remove(arrowHelper)
}
},
}
4 changes: 3 additions & 1 deletion src/directives/vLightHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export const vLightHelper = {
if (currentInstance && currentInstance.dispose) {
currentInstance.dispose()
}
el.parent.remove(currentInstance)
if (el.parent) {
el.parent.remove(currentInstance)
}
},
}

0 comments on commit c505179

Please sign in to comment.