improve PageState trimming
This commit is contained in:
@ -6,21 +6,21 @@
|
||||
{
|
||||
@if (PageState.RenderMode == RenderModes.Interactive)
|
||||
{
|
||||
<ModuleActionsInteractive PageState="@_moduleActionsPageState" ModuleState="@ModuleState" />
|
||||
<ModuleActionsInteractive PageState="@_pageState" ModuleState="@ModuleState" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<ModuleActionsInteractive PageState="@_moduleActionsPageState" ModuleState="@ModuleState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, false)" />
|
||||
<ModuleActionsInteractive PageState="@_pageState" ModuleState="@ModuleState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, false)" />
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
private ModuleActionsPageState _moduleActionsPageState;
|
||||
private PageState _pageState;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// trim PageState to mitigate page bloat caused by Blazor serializing/encrypting state when crossing render mode boundaries
|
||||
_moduleActionsPageState = new ModuleActionsPageState
|
||||
_pageState = new PageState
|
||||
{
|
||||
Alias = PageState.Alias,
|
||||
Page = PageState.Page,
|
||||
|
@ -9,6 +9,7 @@ using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using System.Net;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Oqtane.UI;
|
||||
|
||||
// ReSharper disable UnassignedGetOnlyAutoProperty
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
@ -22,7 +23,7 @@ namespace Oqtane.Themes.Controls
|
||||
[Inject] public IModuleService ModuleService { get; set; }
|
||||
[Inject] public IStringLocalizer<ModuleActionsBase> Localizer { get; set; }
|
||||
|
||||
[Parameter] public ModuleActionsPageState PageState { get; set; }
|
||||
[Parameter] public PageState PageState { get; set; }
|
||||
[Parameter] public Module ModuleState { get; set; }
|
||||
|
||||
public List<ActionViewModel> Actions;
|
||||
|
@ -1,12 +0,0 @@
|
||||
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