-
Notifications
You must be signed in to change notification settings - Fork 100
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'insertBefore' of null and Cannot set property 'isReadOnly' of null #83
Comments
Hi Marco, I was trying to reproduce the first issue that you described using your sample. Unfortunately, it always works. I tried to refresh the page a few times but the dev-console is always clear. Any tip that could help reproduce the issue would be appreciated. For the second issue – I'll try to write a test case that will call |
Hi Kamil, thanks for your quick reply. I tried again on my phone and you're right, now the sandbox always seems to work 😥 I'll try to make a more reliable example, and I'll get back to you, thanks again in the meantime :-) |
Hi Kamil, I couldn't really reproduce this on CodeSandbox unfortunately, but I've recreated a minimal viable example on a private GitHub repo. I sent you an invitation to collaborate, can you let me know if it makes sense? |
Is there any chance to make the sample publish? Other developers will be able to reproduce the issue. If more people will be able to check this out, it's more probable that the issue will be fixed. |
Hi Kamil, I've published it for you at https://github.com/thtg88/ckeditor5-react-re-render-error, you may want to re-clone if you have cloned previously as I've done a few changes to reduce code. |
Huge thanks for preparing the entire environment. I'll back to you this week with some update if I'll anything know about the bug. |
No worries thank you guys for all the work you put in this - hope this time the error shows :P |
Seems like shouldComponentUpdate( nextProps ) {
if ( !this.editor ) {
return false;
}
// ...
} fixes an issue Your application does not throw any other errors that you mentioned in the issue. Is the error: |
I haven't been able to isolate the |
I did it :) |
Thanks Kamil, do you reckon this is going to be in a possible next patch release? |
I am trying to write a test that covers my change. When I will be ready, I am going to create a PR. If everything will go smoothly and PR will be merged, I'll release a new version. It should be done next week. I am not sure whether releasing anything on Friday is a good idea :) |
Never a good idea releasing on a Friday :D Thanks for the update and quick resolution! |
Could I ask you about checking whether the proposed solution in https://github.com/ckeditor/ckeditor5-react/pull/85/files fixes your issue? If not, I will appreciate if you write an instruction step by step how to reproduce the mentioned issue. At this moment I can't say your issue and @thtg88's are related to each other. |
Fix: The `<CKEditor>` component will not update anything until it is not ready. Closes #83.
@thtg88, if you will be able to reproduce the second issue, could you report it in a separate issue? PS: You can hide the repository that reproduces the resolved issue. We don't need it anymore. |
Sure, no problem. |
@pomek thank you very much - I can confirm this has fixed the |
Hi guys, I'm trying to use your CKEditor 5 React component in a Create React App v2, to build a big form, together with other standard HTML form inputs, and other instances of CKEditor all in the same form.
The form itself is driven by a HOC with a data structure which drives all of the form state, something in the lines of:
Part of this state/schema waits for additional values to be updated after a fetch call is fired to a REST API, basically in order to populate select options and values.
This causes a few setStates right at the moment of fetch (to update UI state with spinners), and at the moment of receiving back those values (simply updating the state with them).
While this works seamlessly with other form inputs, it looks like CKEditor throws an error if there are too many setStates close to each other, it looks like the this.editor instance in the CKEditor component is not refreshed in time and a
TypeError: Cannot read property 'insertBefore' of null
is thrown.I've created a CodeSandbox for you to try, while it is not exactly the same code I'm using (the CodeSandbox leverages hooks, and setInterval for firing off quick and close to each other setState calls), it can hopefully showcase the problem.
https://codesandbox.io/s/py52ll3v4j?fontsize=14
Additional to that (this I can't really reproduce on CodeSandbox unfortunately), CKEditor throws another error on my CRA when the disabled prop is passed to the CKEditor component and these repeated setState calls throw the error
TypeError: Cannot set property 'isReadOnly' of null
Which seems to occur since the latest v1.1.2 (was not occurring on v1.1.1) due to this edit in shouldComponentUpdate.
Could you point me in the right direction if I'm doing something wrong in the way I'm using the component or if there's an issue with CKEditor itself?
Thanks guys,
Marco
The text was updated successfully, but these errors were encountered: