add SiteState.IsPrerendering property back to avoid breaking change. New implementation relies on .NET 8 HttpContext CascadingParameter

This commit is contained in:
sbwalker 2023-11-15 15:00:34 -05:00
parent 5ab2f6ea3a
commit 6b2a5d7777
2 changed files with 5 additions and 0 deletions

View File

@ -49,6 +49,9 @@
[Parameter]
public string AuthorizationToken { get; set; }
[CascadingParameter]
HttpContext HttpContext { get; set; }
private bool _initialized = false;
private string _display = "display: none;";
private Installation _installation = new Installation { Success = false, Message = "" };
@ -60,6 +63,7 @@
SiteState.RemoteIPAddress = RemoteIPAddress;
SiteState.AntiForgeryToken = AntiForgeryToken;
SiteState.AuthorizationToken = AuthorizationToken;
SiteState.IsPrerendering = (HttpContext != null) ? true : false;
_installation = await InstallationService.IsInstalled();
if (_installation.Alias != null)

View File

@ -9,6 +9,7 @@ namespace Oqtane.Shared
public string AntiForgeryToken { get; set; } // passed from server for use in service calls on client
public string AuthorizationToken { get; set; } // passed from server for use in service calls on client
public string RemoteIPAddress { get; set; } // passed from server as cannot be reliably retrieved on client
public bool IsPrerendering { get; set; }
private dynamic _properties;
public dynamic Properties => _properties ?? (_properties = new PropertyDictionary());