-
Notifications
You must be signed in to change notification settings - Fork 101
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 properties of null (reading 'model') / Watchdog causing issues with quick rerender #370
Comments
I am getting the same errror, i am using react version v5.1.0 |
I think the OP problem may be related to the Next.js 🤔 @Mgsy or @LukaszGudel have you seen something like this? |
Is there any update on this issue? I have same problem on 6.0. |
I have the same problem too |
I cannot find the corresponding issue, but I remember that one change somehow made it work in some other case. It was a switch from the arrow function assigned to a variable to a function declaration: Change this const uploadPlugin = (editor) => { // ... To this function uploadPlugin(editor) { //... and maybe other variable functions as well. Could you check @rujal408? |
@Witoso, this solution is not feasible as we have not used uploadPlugin function. Is there any other way ? |
Plain 17-th React. No SSR. The same issue on destroy sometimes.
UPD: |
It would be great to have some reproducible sample, as there are many ways of bundling the editor and React (and Next.js from the OP). Could someone provide it? |
Is it correct implementation to have the 151th
Wouldn't it be better to remove event handler for errors at the end calling _stopErrorHandling() instead of 151th line? It is obvisously not the reason of |
After some investigation within a complex solution, I'm ready to share how it happens that this error is raised by CKE5 and its watchdog feature under the hood in particular. In my case, there is a custom build from sources. Thus, I removed all plugins except Essentials as the first step, but an error still existed. The root issue is that there are multiple very fast rerenders on the parent level. Hence, To eliminate such an error, you should either:
|
Hey @AliaksandrBortnik!
As far as I understand, it's not needed. One is closing the error listening, the other is to prevent the possible triggers of watchdog and its data preservation mechanism. Two distinct cases.
Very interesting, thanks for the deep dive. What's the use case on your side? Is it testing related? |
@Witoso absolutely not related to any kind of testing at all. In my case, on one of higher level, there was a quick force update via key prop. It seems watchdog was not able to get a newly created instance so fast at the time it should start destroying. In other words, React's key value has been quickly changed and then the same component unmounted very fast. So, watchdog had to recreate an instance of CKE5 (when key is changed) and instantly start destroying. Thus, watchdog had to start the destroy process in the moment when a creation phase is probably still in progress => no model ready to destroy. Promise rejection happens on |
We caught two such places in our codebase. The simple reason of the error is that on a parent level we do complete DOM destroy for a React sub-tree of components, and recreate it quickly. E.g. we async load something with a content placeholder wrapper which do not render children (including CKE5 inside as a child) if isLoading content now. CKE5 watchdog cannot construct everything so fast at the time we request destroy of CKE5 instance. This is why CKE5 watchdog raises promise rejection. To solve it, some redundant updates were eliminated. |
Thanks for the details, I will add the links to our watchdog <> react improvements notes. |
…appearing [PT #186068199] ckeditor probably doesnt currently work adequately ckeditor/ckeditor5-react#370 (comment) ckeditor/ckeditor5-react#383
I am trying to create an image uploader but am facing an issue
TypeError: Cannot read properties of null (reading 'model')
Here is my code
When i comment out the following section there's no issue
This is the use case on the page since am using next js
The text was updated successfully, but these errors were encountered: