Merge pull request #5017 from sbwalker/dev
fix #5014 - page content scripts not loading on initial page request in Interactive rendering
This commit is contained in:
commit
e483945d05
|
@ -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
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace Oqtane.Controllers
|
|||
page.IsDeleted = currentPage.IsDeleted;
|
||||
|
||||
// update page
|
||||
UpdatePage(page, page.Path, newPath, deleted);
|
||||
UpdatePage(page, page.PageId, page.Path, newPath, deleted);
|
||||
|
||||
// get differences between current and new page permissions
|
||||
var added = GetPermissionsDifferences(page.PermissionList, currentPermissions);
|
||||
|
@ -376,9 +376,9 @@ namespace Oqtane.Controllers
|
|||
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)
|
||||
{
|
||||
var urlMapping = _urlMappings.GetUrlMapping(page.SiteId, page.Path);
|
||||
|
@ -405,7 +405,7 @@ namespace Oqtane.Controllers
|
|||
// update any children
|
||||
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