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.

initialValue will overwrite newer set value

See original GitHub issue

The content of the Editor is loaded asynchronously, but I wanted to render the Editor itself already, because it takes quite some time. Problem is, that when changing the “value” attribute between the initial mounting and the final init of the editor, it will be overwritten by the “init” callback:

in src/components/Editor.tsx:

editor.on('init', () => {
  this.initEditor(editor, initialValue);
});

I think the solution would be to guess the initialValue in the “initEditor” function instead of giving it here as an parameter.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ribxcommented, Apr 5, 2018

I was not. I was using value. Async is the problem, it works like this:

  1. Editor is initialized first time with value="", that value is set inside the editor.on('init',...) event
  2. Asynchronously loaded initial values arrive and are given to the editor component with value="initial" and are set through the componentWillReceiveProps function
  3. Editor is loaded, init event is fired which overwrites the content with the older value from the initialization
0reactions
ribxcommented, Apr 16, 2018

Works like a charm, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overwrite initial value from redux-form - reactjs - Stack Overflow
Before passing initialValues prop down to your redux-form component, you can modify it. Something like that:
Read more >
Overwrite Initial Value on parameter form - Oracle Communities
When the parameter form is displayed, I have the initial value on my parameter form. I overwrite the p_month parameter with another value....
Read more >
Initialize Signals and Discrete States - MATLAB & Simulink
Affects code generation only. For simulation, setting the initial value for S3 is irrelevant because the values are overwritten at model simulation start...
Read more >
Editable keys - AppSheet Help - Google Support
In the AppSheet Editor, add the new key column, mark it as the Key, set its Initial Value to UNIQUEID() , and make...
Read more >
Initial Value Templates - Sanity.io
If you want to clear the initial value defined for a nested type, you can do this by setting the initial value to...
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