don't use addCallback for triggering onCreate

This commit is contained in:
ad1992 2022-05-04 13:30:42 +05:30
parent 645f9a5dc0
commit c93d8f4bd0

View File

@ -458,20 +458,17 @@ class App extends React.Component<AppProps, AppState> {
locked: false,
});
const unbind = this.scene.addCallback(() => {
const customElementConfig = getCustomElementConfig(
this.props.customElementsConfig,
customElement.customType,
);
if (customElementConfig && customElementConfig.onCreate) {
customElementConfig.onCreate(customElement);
}
});
this.scene.replaceAllElements([
...this.scene.getElementsIncludingDeleted(),
customElement,
]);
unbind();
const customElementConfig = getCustomElementConfig(
this.props.customElementsConfig,
customElement.customType,
);
if (customElementConfig && customElementConfig.onCreate) {
customElementConfig.onCreate(customElement);
}
};
private renderCanvas() {