-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encounter editor being unmounted, but something still setting the state #45
Comments
After some investigating, I found that during cleanup at the ReactTrixRTEInput's useEffect(() => {
console.log("1. mount", trixRTEInputRef);
if (trixRTEInputRef && trixRTEInputRef.current) {
const { addEventListener } = trixRTEInputRef.current;
addEventListener("trix-change", handleChange);
if (onFocus) addEventListener("trix-focus", onFocus);
if (onBlur) addEventListener("trix-blur", onBlur);
if (onInitialize) addEventListener("trix-initialize", onInitialize);
if (onFileAccepted) addEventListener("trix-file-accept", onFileAccepted);
if (onAttachmentAdd) addEventListener("trix-attachment-add", onAttachmentAdd);
if (onAttachmentRemove) addEventListener("trix-attachment-remove", onAttachmentRemove);
if (onSelectionChange) addEventListener("trix-selection-change", onSelectionChange);
if (onBeforeInitialize) addEventListener("trix-before-initialize", onBeforeInitialize);
}
return () => {
console.log("2. unmount", trixRTEInputRef);
if (trixRTEInputRef && trixRTEInputRef.current) {
const { removeEventListener } = trixRTEInputRef.current;
console.log("is removeEventListener been called?", trixRTEInputRef.current)
removeEventListener("trix-change", handleChange);
if (onFocus) removeEventListener("trix-focus", onFocus);
if (onBlur) removeEventListener("trix-blur", onBlur);
if (onInitialize) removeEventListener("trix-initialize", onInitialize);
if (onFileAccepted) removeEventListener("trix-file-accept", onFileAccepted);
if (onAttachmentAdd) removeEventListener("trix-attachment-add", onAttachmentAdd);
if (onSelectionChange) removeEventListener("trix-selection-change", onSelectionChange);
if (onAttachmentRemove) removeEventListener("trix-attachment-remove", onAttachmentRemove);
if (onBeforeInitialize) removeEventListener("trix-before-initialize", onBeforeInitialize);
}
};
}, []) I noticed that the console log of |
Any idea if you think you encounter this issues also? I can pretty much confirm the cleanup is not being executed. Sorry to bother once again :( |
@mech Sorry I was away for a few days. I will debug this issue this weekend. |
@mech I am not able to reproduce this issue in my environment. Would you be able to share some more context or reproduction sandbox? 😊 |
Not sure if this is related with the way I try to lazy load the editor to solve windows problem. In my Next.js, I load the editor like so:
However, after I navigate to elsewhere and start typing, I have this warning:
The text was updated successfully, but these errors were encountered: