Why is Codemirror#componentWillReceiveProps async?
See original GitHub issueThere might be a very good reason I’m not aware of for debouncing componentWillReceiveProps
by default, but it created a lot of headache when it comes to state synchronization (refs https://github.com/mozilla-services/react-jsonschema-form/pull/175).
What’s the reasoning behind scheduling it to the next tick, perfs? Could it be conceivable to make this an optional behavior?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
reactjs - why is componentWillReceiveProps deprecated?
componentWillReceiveProps is a synchronous hook. Calling asynchronous function like data fetching inside this hook will need to render in ...
Read more >How to use the codemirror.Doc function in codemirror - Snyk
To help you get started, we've selected a few codemirror. ... getCodeMirror = async (el: Element) => { const { code, id, title,...
Read more >HTMLSelect | @jupyterlab - JupyterLab Documentation
If using the new style context, re-declare this in your class to be the React.ContextType of your static contextType . Should be used...
Read more >Promises support for the linter add-on - CodeMirror
Hi, I'm wondering why the linter plugin is not supporting Promises as hinter plugin does, but just the .async prop with callback.
Read more >Reloading the page while debugger's Editor/CodeMirror is ...
And this editor has an async initialization to create CodeMirror, which requires the consumer to first call appendTo which is async.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The debouncing causes me some trouble as well. It appears that the debounce applies to all instances of the component on a page simultaneously, so if they all try to re-render at once, only the last instance will actually show a change.
This was the issue I described in #46, which I closed because I found a way to work around it. However, this will still be a problem for instances like drag & drop sorting, where there is more than one instance that legitimately needs to re-render at the same time.
Here’s a link to a video demonstrating the issue.
https://youtu.be/-mbHy17bxZw
This appears to be a duplicate of #106. I ran into the same issue and created react-codemirror2 because I was dying over the debouncing issue (and couldn’t sleep at night with the lodash dependency). My wrapper component is very barebones, surely needs some more work, but works well for my simple usage. I’ll be maintaining it moving forward so any struggles going on here I’ll happily work out in the alternative package. Please let me know if anyone takes the time to check it out and finds it useful - thanks.