Skip to content

Commit

Permalink
Cleanup old component
Browse files Browse the repository at this point in the history
  • Loading branch information
gky360 committed Nov 7, 2021
1 parent 189bca2 commit 4cc4498
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/Component/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ export const Component: React.FC<ComponentProps> = ({
}
}, [component, onLoad]);

useEffect(() => {
return () => {
if (component) {
stage.removeComponent(component);
}
};
}, [component, stage]);

useEffect(() => {
if (component) {
const nextParams = mergeParams(params, ComponentDefaultParameters);
Expand Down

0 comments on commit 4cc4498

Please sign in to comment.