fix #5014 - page content scripts not loading on initial page request in Interactive rendering
This commit is contained in:
parent
0ef24ebc3f
commit
7a9c637e03
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
RenderFragment DynamicComponent { get; set; }
|
RenderFragment DynamicComponent { get; set; }
|
||||||
|
|
||||||
private string lastPagePath = "";
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
// handle page redirection
|
// handle page redirection
|
||||||
|
@ -92,8 +90,9 @@
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
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"))
|
if (!string.IsNullOrEmpty(PageState.Site.HeadContent) && PageState.Site.HeadContent.Contains("<script"))
|
||||||
{
|
{
|
||||||
await InjectScripts(PageState.Site.HeadContent, ResourceLocation.Head);
|
await InjectScripts(PageState.Site.HeadContent, ResourceLocation.Head);
|
||||||
|
@ -102,6 +101,7 @@
|
||||||
{
|
{
|
||||||
await InjectScripts(PageState.Site.BodyContent, ResourceLocation.Body);
|
await InjectScripts(PageState.Site.BodyContent, ResourceLocation.Body);
|
||||||
}
|
}
|
||||||
|
// page content
|
||||||
if (!string.IsNullOrEmpty(PageState.Page.HeadContent) && PageState.Page.HeadContent.Contains("<script"))
|
if (!string.IsNullOrEmpty(PageState.Page.HeadContent) && PageState.Page.HeadContent.Contains("<script"))
|
||||||
{
|
{
|
||||||
await InjectScripts(PageState.Page.HeadContent, ResourceLocation.Head);
|
await InjectScripts(PageState.Page.HeadContent, ResourceLocation.Head);
|
||||||
|
@ -110,7 +110,6 @@
|
||||||
{
|
{
|
||||||
await InjectScripts(PageState.Page.BodyContent, ResourceLocation.Body);
|
await InjectScripts(PageState.Page.BodyContent, ResourceLocation.Body);
|
||||||
}
|
}
|
||||||
lastPagePath = PageState.Page.Path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// style sheets
|
// style sheets
|
||||||
|
|
|
@ -288,7 +288,7 @@ namespace Oqtane.Controllers
|
||||||
page.IsDeleted = currentPage.IsDeleted;
|
page.IsDeleted = currentPage.IsDeleted;
|
||||||
|
|
||||||
// update page
|
// update page
|
||||||
UpdatePage(page, page.Path, newPath, deleted);
|
UpdatePage(page, page.PageId, page.Path, newPath, deleted);
|
||||||
|
|
||||||
// get differences between current and new page permissions
|
// get differences between current and new page permissions
|
||||||
var added = GetPermissionsDifferences(page.PermissionList, currentPermissions);
|
var added = GetPermissionsDifferences(page.PermissionList, currentPermissions);
|
||||||
|
@ -376,9 +376,9 @@ namespace Oqtane.Controllers
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePage(Page page, string oldPath, string newPath, bool deleted)
|
private void UpdatePage(Page page, int pageId, string oldPath, string newPath, bool deleted)
|
||||||
{
|
{
|
||||||
var update = false;
|
var update = (page.PageId == pageId);
|
||||||
if (oldPath != newPath)
|
if (oldPath != newPath)
|
||||||
{
|
{
|
||||||
var urlMapping = _urlMappings.GetUrlMapping(page.SiteId, page.Path);
|
var urlMapping = _urlMappings.GetUrlMapping(page.SiteId, page.Path);
|
||||||
|
@ -405,7 +405,7 @@ namespace Oqtane.Controllers
|
||||||
// update any children
|
// update any children
|
||||||
foreach (var _page in _pages.GetPages(page.SiteId).Where(item => item.ParentId == page.PageId))
|
foreach (var _page in _pages.GetPages(page.SiteId).Where(item => item.ParentId == page.PageId))
|
||||||
{
|
{
|
||||||
UpdatePage(_page, oldPath, newPath, deleted);
|
UpdatePage(_page, pageId, oldPath, newPath, deleted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user