Skip to content
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

Unable to edit blogs #44

Closed
tranpl opened this issue Mar 29, 2024 · 12 comments
Closed

Unable to edit blogs #44

tranpl opened this issue Mar 29, 2024 · 12 comments

Comments

@tranpl
Copy link

tranpl commented Mar 29, 2024

Microsoft.JSInterop.JSException: Cannot read properties of null (reading '__quill')
TypeError: Cannot read properties of null (reading '__quill')
at Object.getQuillHTML (https://localhost/js/quill-interop.js:30:30)
at https://localhost/_framework/blazor.web.js:1:3244
at new Promise ()
at y.beginInvokeJSFromDotNet (https://localhost/_framework/blazor.web.js:1:3201)
at gn._invokeClientMethod (https://localhost/_framework/blazor.web.js:1:62841)
at gn._processIncomingData (https://localhost/_framework/blazor.web.js:1:60316)
at connection.onreceive (https://localhost/_framework/blazor.web.js:1:53957)
at i.onmessage (https://localhost/_framework/blazor.web.js:1:82102)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Oqtane.Modules.Controls.RichTextEditor.OnAfterRenderAsync(Boolean firstRender) in C:\Source\Projects\oqtane.framework\Oqtane.Client\Modules\Controls\RichTextEditor.razor:line 192
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Oqtane Version 5.1.0
Blog Module Version 5.0.3

@vnetonline
Copy link
Contributor

I am also getting the same problem

@sbwalker
Copy link
Member

sbwalker commented Apr 9, 2024

@vnetonline are you getting the error from the latest code in this repo… or from installing the package in the Marketplace?

@vnetonline
Copy link
Contributor

From installing it from market place

@vnetonline
Copy link
Contributor

vnetonline commented Apr 9, 2024

I just forked the repo and I get the same error when trying to edit an existing blog

@tranpl
Copy link
Author

tranpl commented Apr 9, 2024

the blogs module was downloaded from the marketplace, oqtane from github compiled @sbwalker

@sbwalker
Copy link
Member

Is it possible it could have been resolved by this recent PR - oqtane/oqtane.framework#4111 (Oqtane Framework dev branch)

@sbwalker
Copy link
Member

I am not able to reproduce this problem using the latest code in the dev branch of the Oqtane Framework

@vnetonline
Copy link
Contributor

I am still getting the issue i have run the latest changes from the Dev branch and have just updated the SDK to 8.0.4 on my local copy of the blog still have the same issue

Adding content is fine
Unable to edit the content once entered,

I have noticed that the OnInitializedAsync is hit twice and on the second run, the error occurs

screencast_blog_edit_errorerror

@sbwalker
Copy link
Member

@tranpl @vnetonline I am able to reproduce the problem now... I will investigate further today. Its very strange, as I am using the Blog module on https://www.oqtane.org (and other sites) without any issues.

sbwalker added a commit to oqtane/oqtane.framework that referenced this issue Apr 11, 2024
fix oqtane/oqtane.blogs#44 - rich text editor throwing exception in specific scenario
@sbwalker
Copy link
Member

sbwalker commented Apr 11, 2024

@tranpl @vnetonline this PR oqtane/oqtane.framework#4126 resolves the issue in the RichTextEditor. The problem was basically a race condition due to JS Interop. The JS Interop call to CreateEditor on firstRender can sometimes take time (depending on the environment) which means that OnAfterRenderAsync could be called a second time with firstRender = false BEFORE the first OnAfterRenderAsync call completed. This could result in the component trying to access a method on the RichTextEditor before it actually exists. The resolution is to explicitly control the flow within the component by tracking whether the firstRender event completed or not.

So this required a fix to the framework which will be released in 5.1.1

@vnetonline
Copy link
Contributor

I can confirm that PR oqtane/oqtane.framework#4126 resolves the issue in the RichTextEditor and now I am able to edit the blogs

@tranpl
Copy link
Author

tranpl commented Apr 12, 2024

thank you @sbwalker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants