Open marc0n3 opened 8 months ago
I also encountered the same bug with strict react mode. :(
Hi ! did you find a reasonable workaround ? I have to disable StrictMode every time I want to work with image editor, and it's not really satisfying. See you
Describe the bug I've developed a typescript wrapper for the component. I suspect that, because strict mode react invoke effects twice, the initialization process of TuiImageEditor fails.
I've an error on
this._invoker.on(EXECUTE_COMMAND, function (command) { return _this2.ui.fire(EXECUTE_COMMAND, command); });
when image is first loaded. Ui is null.
I suppose that destroy is resetting it.
To Reproduce `import React, {useEffect, useRef} from "react"; import TuiImageEditor from "tui-image-editor"; import "tui-image-editor/dist/tui-image-editor.css"; import "tui-color-picker/dist/tui-color-picker.css";
import "./imageEditor.scss";
export const ImageEditor = ({imageDataUrl}: { imageDataUrl: string }) => { const containerRef = useRef(null);
const imageEditorRef = useRef<TuiImageEditor | null>(null);
};`
Expected behavior I expect initialization to stop on destroyed components.