react-email-editor icon indicating copy to clipboard operation
react-email-editor copied to clipboard

Uncaught Error when quickly mounted and unmounted

Open timothy003 opened this issue 3 years ago • 0 comments

Unmounting the editor immediately after it's mounted causes an error to be thrown afterwards, making Cypress tests fail.

import { useEffect, useState } from "react";
import EmailEditor from "react-email-editor";

export default function Test() {
  const [mount, setMount] = useState(true);
  useEffect(() => setMount(false), []);
  return mount && <EmailEditor editorId="editor" />;
}
Uncaught Error: Could not find a valid element for given id or className.
    at e.value (embed.js?2:1:18685)
    at e.value (embed.js?2:1:17937)
    at new e (embed.js?2:1:17790)
    at a.value (embed.js?2:1:29286)
    at _this.loadEditor (index.js:42:30)
    at runCallbacks2 (loadScript.js:27:7)
    at embedScript.onload (loadScript.js:42:7)

timothy003 avatar Oct 25 '22 19:10 timothy003