diff --git a/app/pages/PageEnigma/PageEnigma.tsx b/app/pages/PageEnigma/PageEnigma.tsx index 1a1efaf667..db092321f8 100644 --- a/app/pages/PageEnigma/PageEnigma.tsx +++ b/app/pages/PageEnigma/PageEnigma.tsx @@ -30,26 +30,17 @@ export const PageEnigma = () => { const canvasRef = useRef(null); const editorRef = useRef(null); - const editorCallback = useCallback(() => { // handle editorCallback here },[]); useEffect(() => { //componentDidMount - editorRef.current = new Editor(); - function init(){ - if(editorRef.current!==null){ - //TODO: init with editorRef.current.initialize(editorCallback); - editorRef.current.initialize(); - } - } - - if(canvasRef!==null){ - init(); - }else{ - setTimeout(init, 500); + if (editorRef.current == null) { + editorRef.current = new Editor(); + editorRef.current.initialize(); } + }, []); const handleButtonSave = ()=>{ diff --git a/app/pages/PageEnigma/js/editor.js b/app/pages/PageEnigma/js/editor.js index d56f66eb4f..b124caf323 100644 --- a/app/pages/PageEnigma/js/editor.js +++ b/app/pages/PageEnigma/js/editor.js @@ -31,6 +31,7 @@ class Editor { // Default params. constructor() { + console.log("If you see this message twice! then it rendered twice, if you see it once it's all good.") // For making sure the editor only gets created onece. this.can_initailize = false; let one_element = document.getElementById("created-one-element");