tinymce / tinymce-blazor

Blazor integration
MIT License
45 stars 14 forks source link

Version 5 causes error that version 3 does not have. #15

Closed hevilhuy closed 3 years ago

hevilhuy commented 3 years ago

This error on occur in version 5. I tried to rollback to version 3 and everything is OK. image

exalate-issue-sync[bot] commented 3 years ago

Ref: INT-2544

jscasca commented 3 years ago

@hevilhuy I haven't seen this before so my best guess is that it is related to how the element is being disposed.

When in the element life-cycle is the error appearing? Do you have a small replication case that we can use to better understand the situation? Maybe a small github project?

hevilhuy commented 3 years ago

I can share my live share to you. Do you use Discord?

hevilhuy commented 3 years ago

image

This message is on production server.

jscasca commented 3 years ago

Yeah, unfortunately, I only have a Mac available at the time and Visual Studio Mac doesn't support liveshare.

But the first error is definitely an issue with disposing of the element. The second screenshot looks like JS is trying to call the c# code and fails, so maybe is trying to reach out to it with the outdated reference?

Let me dig a bit more into it.

hevilhuy commented 3 years ago

Please add me on Discord and we will discuss this. My Discord is Red Wei#2396

nguyenhthai commented 3 years ago

Just recently encountered this issue as well. I believe this happened when there are 2 or more instances of tinymce in the page. I did some digging with at least 2 instance of tinymce.

During the dispose process, destroy() method is called and successfully removed the first instance. Then destroy() is called again and also successfully removed the second one. However, after this, editor.on(blazorConf.modelEvents) is triggered, which in turn calls the update() method. update() method does use dotNetRef which is already gone at that time.

hevilhuy commented 3 years ago

Just recently encountered this issue as well. I believe this happened when there are 2 or more instances of tinymce in the page. I did some digging with at least 2 instance of tinymce.

During the dispose process, destroy() method is called and successfully removed the first instance. Then destroy() is called again and also successfully removed the second one. However, after this, editor.on(blazorConf.modelEvents) is triggered, which in turn calls the update() method. update() method does use dotNetRef which is already gone at that time.

Việt Nam điểm danh!

jscasca commented 3 years ago

Yeah, thanks to @hevilhuy I could work out a simple replication. Easiest way out is to just unbind all the events before disposing of the Editor to avoid that error

This should be fixed with #16