From f6fb3cc7664f7dc25433609075b52a56c18d8c89 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Fri, 9 Feb 2024 10:59:51 -0500 Subject: [PATCH] specify default interactive render mode --- Oqtane.Client/UI/ModuleInstance.razor | 5 +++-- Oqtane.Client/UI/RenderMode.cs | 2 +- Oqtane.Client/UI/RenderModeBoundary.razor | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Oqtane.Client/UI/ModuleInstance.razor b/Oqtane.Client/UI/ModuleInstance.razor index 53ac20f64..b217749b2 100644 --- a/Oqtane.Client/UI/ModuleInstance.razor +++ b/Oqtane.Client/UI/ModuleInstance.razor @@ -1,14 +1,15 @@ @namespace Oqtane.UI @inject SiteState SiteState -
Render Mode: @ModuleState.RenderMode

@if (PageState.Site.RenderMode == RenderModes.Interactive || ModuleState.RenderMode == RenderModes.Static) { +
Render Mode: @PageState.Site.RenderMode

} else { - +
Render Mode: @ModuleState.RenderMode

+ } @code { diff --git a/Oqtane.Client/UI/RenderMode.cs b/Oqtane.Client/UI/RenderMode.cs index c9cd35579..a6c1c8652 100644 --- a/Oqtane.Client/UI/RenderMode.cs +++ b/Oqtane.Client/UI/RenderMode.cs @@ -17,7 +17,7 @@ public static IComponentRenderMode GetInteractiveRenderMode(string runtime, bool case Runtimes.Auto: return new InteractiveAutoRenderMode(prerender); } - return null; + return new InteractiveServerRenderMode(prerender); // default to interactiver server } } } diff --git a/Oqtane.Client/UI/RenderModeBoundary.razor b/Oqtane.Client/UI/RenderModeBoundary.razor index 824797d0c..73127f544 100644 --- a/Oqtane.Client/UI/RenderModeBoundary.razor +++ b/Oqtane.Client/UI/RenderModeBoundary.razor @@ -1,5 +1,5 @@ @namespace Oqtane.UI -@inject SiteState SiteStateService +@inject SiteState ComponentSiteState // can refer to either a static or interactive SiteState - it depends on the render mode @inject IStringLocalizer Localizer @inject ILogService LoggingService @inherits ErrorBoundary @@ -71,11 +71,11 @@ else if (ModuleType != null) { // repopulate the SiteState service based on the values passed in the SiteState parameter (this is how state is marshalled across the render mode boundary) - SiteStateService.Alias = SiteState.Alias; - SiteStateService.AntiForgeryToken = SiteState.AntiForgeryToken; - SiteStateService.AuthorizationToken = SiteState.AuthorizationToken; - SiteStateService.RemoteIPAddress = SiteState.RemoteIPAddress; - SiteStateService.IsPrerendering = SiteState.IsPrerendering; + ComponentSiteState.Alias = SiteState.Alias; + ComponentSiteState.AntiForgeryToken = SiteState.AntiForgeryToken; + ComponentSiteState.AuthorizationToken = SiteState.AuthorizationToken; + ComponentSiteState.RemoteIPAddress = SiteState.RemoteIPAddress; + ComponentSiteState.IsPrerendering = SiteState.IsPrerendering; ModuleParameters = new Dictionary { { "RenderModeBoundary", this } }; }