Skip to content

Commit

Permalink
Merge pull request #4352 from sbwalker/dev
Browse files Browse the repository at this point in the history
fix #4349 - adding module in subsite in Interactive render mode
  • Loading branch information
sbwalker authored Jun 24, 2024
2 parents 1c943cc + 73abc51 commit 08213ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Oqtane.Client/UI/SiteRouter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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);
}
Expand Down
9 changes: 6 additions & 3 deletions Oqtane.Server/Services/SiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public async Task<List<Site>> GetSitesAsync()

public async Task<Site> 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);
Expand Down Expand Up @@ -240,7 +241,8 @@ public async Task DeleteSiteAsync(int siteId)

public async Task<List<Module>> 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);
Expand All @@ -259,7 +261,8 @@ public async Task<List<Module>> GetModulesAsync(int siteId, int pageId)

public async Task<List<Module>> 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);
Expand Down

0 comments on commit 08213ae

Please sign in to comment.