fix #5014 - page content scripts not loading on initial page request in Interactive rendering
This commit is contained in:
@ -11,8 +11,6 @@
|
||||
|
||||
RenderFragment DynamicComponent { get; set; }
|
||||
|
||||
private string lastPagePath = "";
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// handle page redirection
|
||||
@ -92,8 +90,9 @@
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (!firstRender && PageState.Page.Path != lastPagePath)
|
||||
if (!firstRender)
|
||||
{
|
||||
// site content
|
||||
if (!string.IsNullOrEmpty(PageState.Site.HeadContent) && PageState.Site.HeadContent.Contains("<script"))
|
||||
{
|
||||
await InjectScripts(PageState.Site.HeadContent, ResourceLocation.Head);
|
||||
@ -102,6 +101,7 @@
|
||||
{
|
||||
await InjectScripts(PageState.Site.BodyContent, ResourceLocation.Body);
|
||||
}
|
||||
// page content
|
||||
if (!string.IsNullOrEmpty(PageState.Page.HeadContent) && PageState.Page.HeadContent.Contains("<script"))
|
||||
{
|
||||
await InjectScripts(PageState.Page.HeadContent, ResourceLocation.Head);
|
||||
@ -110,7 +110,6 @@
|
||||
{
|
||||
await InjectScripts(PageState.Page.BodyContent, ResourceLocation.Body);
|
||||
}
|
||||
lastPagePath = PageState.Page.Path;
|
||||
}
|
||||
|
||||
// style sheets
|
||||
|
Reference in New Issue
Block a user