Browse Source

unbind onCreate once executed

ad1992 3 years ago
parent
commit
6eb0cf6a10
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/components/App.tsx

+ 2 - 1
src/components/App.tsx

@@ -453,7 +453,7 @@ class App extends React.Component<AppProps, AppState> {
       height,
     });
 
-    this.scene.addCallback(() => {
+    const unbind = this.scene.addCallback(() => {
       const customElementConfig = getCustomElementConfig(
         this.props.customElementsConfig,
         customElement.customType,
@@ -466,6 +466,7 @@ class App extends React.Component<AppProps, AppState> {
       ...this.scene.getElementsIncludingDeleted(),
       customElement,
     ]);
+    unbind();
   };
 
   private renderCanvas() {