question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is Codemirror#componentWillReceiveProps async?

See original GitHub issue

There 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:open
  • Created 7 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sslotskycommented, May 2, 2016

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

1reaction
scnirocommented, Jun 1, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found