-
Notifications
You must be signed in to change notification settings - Fork 562
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
Bug: html content is empty when edit in a child site #4017
Comments
This one is a complicated issue... When running on the Server, the component initially makes a call to the HtmlTextService to get the most recent HtmlText object based on the ModuleId. This works fine and returns the correct record. Then Blazor makes another call to the HtmlTextService, and this time the SiteState.Alias is null - so it tries to resolve the correct Alias for the HttpContext, however the HttpContext is: GET http://localhost:44357/_blazor HTTP/1.1 101 Switching Protocols And because the Url is missing the "child" alias path it resolves the Alias to the root domain. And since ModuleId does not belong to the root domain SiteId, it returns an HtmlText object of null. Which is why the RichTextEditor displays no content. I believe the problem is that the second call to the HtmlTextService is transitioning render mode boundaries - ie. from Static to Interactive, as the Edit.razor component is an Interactive component. For some reason the SiteState is not being passed across the render mode boundary - which means the "context" is lost. Note that this is not a problem when using the API approach for data access because the Controller always has the correct Url with the child alias path embedded in it, so it can resolve the Alias correctly. It is also not a problem for root domains because the GET request for _blazor includes the full domain name which can be resolved to an Alias. So this is only an issue for child sites. And it only became an issue after the "dual" service HtmlTextService was added, because previously all data access occurred through the API Controller. |
@sbwalker what I notice is the extra The above only happens on the homepage. I forced the edit component into static and the raw data did exist although the rich editor was broken along with interactivity. So there is definitely an issue with crossing render mode boundaries. |
fix #4017 - SiteState being lost in server rendered scenarios
#4019 fixes the issue. The problem is that there were actually 2 SiteState services registered in the framework - one was defined in the Shared project, and one was defined in the Server project (Infrastructure namespace). The reason why there were 2 is because there were some properties on the SiteState class which were only applicable to Client projects - and these were only included in the Shared version of the class. However now that Blazor is statically rendered server-side, it blurs the lines between client and server components - so it makes sense to only have a single SiteState definition and service. So the fix was to remove the SiteState class from Server/Infrastructure - which allows the framework to marshal the SiteState values properly across the render mode boundary. Thank you @zyhfish for discovering this issue, as it affected the multi-tenancy capability which is one of the core features of Oqtane. |
@sbwalker Nice to see this was resolved and not as huge of an issue as first thought. I made the modifications to source and tested working as expected. I will report the new issue found as I was wondering if it was an issue worth reporting while reviewing this, thank you. |
Reproduce Steps
Expected Result
the html content should display in the editor.
Actually Result
both the rich-text editor and raw editor are empty.
The text was updated successfully, but these errors were encountered: