performance optimization to mitigate page bloat caused by Blazor serializing/encrypting state when crossing render mode boundaries
This commit is contained in:
@ -6,10 +6,26 @@
|
||||
{
|
||||
@if (PageState.RenderMode == RenderModes.Interactive)
|
||||
{
|
||||
<ModuleActionsInteractive PageState="@PageState" ModuleState="@ModuleState" />
|
||||
<ModuleActionsInteractive PageState="@_moduleActionsPageState" ModuleState="@ModuleState" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<ModuleActionsInteractive PageState="@PageState" ModuleState="@ModuleState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, false)" />
|
||||
<ModuleActionsInteractive PageState="@_moduleActionsPageState" ModuleState="@ModuleState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, false)" />
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
private ModuleActionsPageState _moduleActionsPageState;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// trim PageState to mitigate page bloat caused by Blazor serializing/encrypting state when crossing render mode boundaries
|
||||
_moduleActionsPageState = new ModuleActionsPageState
|
||||
{
|
||||
Alias = PageState.Alias,
|
||||
Page = PageState.Page,
|
||||
User = PageState.User,
|
||||
EditMode = PageState.EditMode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,7 @@ using Oqtane.Models;
|
||||
using Oqtane.Security;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
using System.Net;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
// ReSharper disable UnassignedGetOnlyAutoProperty
|
||||
@ -24,7 +22,7 @@ namespace Oqtane.Themes.Controls
|
||||
[Inject] public IModuleService ModuleService { get; set; }
|
||||
[Inject] public IStringLocalizer<ModuleActionsBase> Localizer { get; set; }
|
||||
|
||||
[Parameter] public PageState PageState { get; set; }
|
||||
[Parameter] public ModuleActionsPageState PageState { get; set; }
|
||||
[Parameter] public Module ModuleState { get; set; }
|
||||
|
||||
public List<ActionViewModel> Actions;
|
||||
|
@ -0,0 +1,12 @@
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Themes.Controls
|
||||
{
|
||||
public class ModuleActionsPageState
|
||||
{
|
||||
public Alias Alias { get; set; }
|
||||
public Page Page { get; set; }
|
||||
public User User { get; set; }
|
||||
public bool EditMode { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user