From 73abc511a8bb7208c476640bb377834206811878 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 24 Jun 2024 16:26:55 -0400 Subject: [PATCH] fix #4349 - adding module in subsite in Interactive render mode --- Oqtane.Client/UI/SiteRouter.razor | 4 ++-- Oqtane.Server/Services/SiteService.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Oqtane.Client/UI/SiteRouter.razor b/Oqtane.Client/UI/SiteRouter.razor index 79e2bef6..222344ae 100644 --- a/Oqtane.Client/UI/SiteRouter.razor +++ b/Oqtane.Client/UI/SiteRouter.razor @@ -213,7 +213,7 @@ return; } - if (PageState == null || refresh || PageState.Page.Path != route.PagePath) + if (refresh || PageState == null || PageState.Page.Path != route.PagePath) { page = site.Pages.FirstOrDefault(item => item.Path.Equals(route.PagePath, StringComparison.OrdinalIgnoreCase)); } @@ -275,7 +275,7 @@ } // get modules for current page - if (PageState.Modules == null || (PageState.Modules.Any() && PageState.Modules.First().PageId != page.PageId)) + if (refresh || PageState.Modules == null || !PageState.Modules.Any() || PageState.Modules.First().PageId != page.PageId) { modules = await SiteService.GetModulesAsync(site.SiteId, page.PageId); } diff --git a/Oqtane.Server/Services/SiteService.cs b/Oqtane.Server/Services/SiteService.cs index 2c9c1786..48eb6c37 100644 --- a/Oqtane.Server/Services/SiteService.cs +++ b/Oqtane.Server/Services/SiteService.cs @@ -62,7 +62,8 @@ namespace Oqtane.Services public async Task GetSiteAsync(int siteId) { - var site = await _cache.GetOrCreateAsync($"site:{_accessor.HttpContext.GetAlias().SiteKey}", async entry => + var alias = _tenantManager.GetAlias(); + var site = await _cache.GetOrCreateAsync($"site:{alias.SiteKey}", async entry => { entry.SlidingExpiration = TimeSpan.FromMinutes(30); return await GetSite(siteId); @@ -240,7 +241,8 @@ namespace Oqtane.Services public async Task> GetModulesAsync(int siteId, int pageId) { - var sitemodules = await _cache.GetOrCreateAsync($"modules:{_accessor.HttpContext.GetAlias().SiteKey}", async entry => + var alias = _tenantManager.GetAlias(); + var sitemodules = await _cache.GetOrCreateAsync($"modules:{alias.SiteKey}", async entry => { entry.SlidingExpiration = TimeSpan.FromMinutes(30); return await GetModulesAsync(siteId); @@ -259,7 +261,8 @@ namespace Oqtane.Services public async Task> GetModulesAsync(int siteId) { - return await _cache.GetOrCreateAsync($"modules:{_accessor.HttpContext.GetAlias().SiteKey}", async entry => + var alias = _tenantManager.GetAlias(); + return await _cache.GetOrCreateAsync($"modules:{alias.SiteKey}", async entry => { entry.SlidingExpiration = TimeSpan.FromMinutes(30); return await GetModules(siteId);