diff --git a/app/contexts/EngineProvider.tsx b/app/contexts/EngineProvider.tsx index d5124cb01d..7c708816c4 100644 --- a/app/contexts/EngineProvider.tsx +++ b/app/contexts/EngineProvider.tsx @@ -1,6 +1,6 @@ import { ReactNode, - useLayoutEffect, + useEffect, useRef, } from "react"; import { EngineContext } from "./EngineContext"; @@ -14,17 +14,23 @@ interface Props{ export const EngineProvider = ({ children }: Props)=>{ const editorRef = useRef(null); - useLayoutEffect(() => { + + useEffect(() => { //componentDidMount - if (editorRef.current == null) { + if (editorRef.current !== null ) { + console.warn('Editor Engine already exist'); + }else if (document.getElementById("video-scene") === null){ + console.error('Editor Engine need a target cavas with the id "video-scene"'); + }else{ editorRef.current = new Editor(); editorRef.current.initialize(); } }, []); - + return( {children} ); -} \ No newline at end of file +} +