fix #5014 - page content scripts not loading on initial page request in Interactive rendering

This commit is contained in:
sbwalker
2025-01-24 14:29:23 -05:00
parent 0ef24ebc3f
commit 7a9c637e03
2 changed files with 7 additions and 8 deletions

View File

@ -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