I also got the same issue, i was upgraded my Next App from v9 to v12. And i found it because the useEffect
My code before was like (my Next v9) =
useEffect(() => {
return () => {
removeEventListener("blur", updateWarning);
const inputFile = document.getElementById("input-file-ujian");
if (inputFile) {
inputFile.removeEventListener("click", (e) => {
window.removeEventListener("blur", updateWarning);
});
inputFile.removeEventListener("change", handleChange);
}
const videos = document.getElementsByClassName("note-video-clip");
for (let i = 0; i < videos.length; i++) {
videos[i].removeEventListener("mouseleave", () => {
window.addEventListener("blur", updateWarning);
});
videos[i].removeEventListener("mouseenter", () => {
window.removeEventListener("blur", updateWarning);
});
}
};
}, [pesertaUjian, warning]);
and this is my Next v12 (I remove the return code) =
useEffect(() => {
removeEventListener("blur", updateWarning);
const inputFile = document.getElementById("input-file-ujian");
if (inputFile) {
inputFile.removeEventListener("click", (e) => {
window.removeEventListener("blur", updateWarning);
});
inputFile.removeEventListener("change", handleChange);
}
const videos = document.getElementsByClassName("note-video-clip");
for (let i = 0; i < videos.length; i++) {
videos[i].removeEventListener("mouseleave", () => {
window.addEventListener("blur", updateWarning);
});
videos[i].removeEventListener("mouseenter", () => {
window.removeEventListener("blur", updateWarning);
});
}
}, [pesertaUjian, warning]);
I don't know why, I just remove all my return code in my useEffect and it's work for me
Update:
Update, i found that if you are using useEffect and async await. Don't use like it
useEffect(async() => {},[])
but you can create function async await outside the useEffect, for example
const yourFunction = async () => {}
useEffect(() => yourFunction(),[])