Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

useCodeMirror overwrites content if not provided via prop #441

Closed
mrdrogdrog opened this issue Dec 28, 2022 · 3 comments 路 Fixed by #442
Closed

useCodeMirror overwrites content if not provided via prop #441

mrdrogdrog opened this issue Dec 28, 2022 · 3 comments 路 Fixed by #442

Comments

@mrdrogdrog
Copy link
Contributor

mrdrogdrog commented Dec 28, 2022

Greetings

Hello 馃憢 Nice work. 鉂わ笍

Problem

In useCodeMirror.ts you have an effect which overwrites the document content every time the variable value changes.
I use the react-codemirror component in a project where the content comes from a codemirror extension and not via your prop but the effect still triggers on init and overwrites my initial content.

Prefered solution

I can't provide the content via the prop so it would be nice to disable this effect. Please don't execute the dispatch in the effect if no content (null or undefined) was given.

@mrdrogdrog mrdrogdrog changed the title useCodeMirror overwrites content every time useCodeMirror overwrites content if not provided via prop Dec 28, 2022
@jaywcjlove
Copy link
Member

@mrdrogdrog Welcome to submit PR

@mrdrogdrog
Copy link
Contributor Author

@jaywcjlove Very gladly! I'm creating it right now

@jaywcjlove
Copy link
Member

@mrdrogdrog upgrade v4.19.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants