Closed gogo-ashacode closed 1 year ago
I'm unsure I can help without some sort of reproduction really.
Here is a simple version of our app (with same package versions) that reproduces the issue: https://github.com/gogo-ashacode/next-simplemde-issue.
Does that work?
@gogo-ashacode thanks. I'll look at it later.
One of the issues I can see looking at the code a bit closer (yesterday I missed that) that you have import of SimpleMDE inside the render function. WTF lol :D
Move
const SimpleMDE = dynamic(() => import("react-simplemde-editor"), {
ssr: false,
});
Outside of the render and I bet it will start to work nicely.
Checked locally. Moving SimpleMDE out of render obviously fixed it.
OMG, i didn't notice it had been moved inside either! I guess because it's the first time I've seen an import like that and I was obsessed with controlled/uncontrolled input issues that my brain just tuned it out. Sorry to waste your time, but the fresh set of eyes helped, so thanks. 😅
OMG, i didn't notice it had been moved inside either! I guess because it's the first time I've seen an import like that and I was obsessed with controlled/uncontrolled input issues that my brain just tuned it out. Sorry to waste your time, but the fresh set of eyes helped, so thanks. 😅
No problem :)
I am using next.js with this editor, and have attempted athe suggested solutions such as useMemo on options, but it doesn't seem to be fixing the issue for me.
We moved the editor setup into it's own component for easy reuse. Here is my setup:
next: 12.3.1 react: 18.2.0 react-simplemde-editor: ^5.2.0
Markdown editor component
Usage inside another page component:
Same as in the other issues, after the onChange is triggered while typing focus is lost and you need to click into the editor to type the next letter.
Any help would be appreciated.