add variability for StreamRendering based on render mode
This commit is contained in:
parent
38ead4909e
commit
fa17e7019a
|
@ -1,19 +1,18 @@
|
||||||
@namespace Oqtane.UI
|
@namespace Oqtane.UI
|
||||||
@inject SiteState SiteState
|
@inject SiteState SiteState
|
||||||
|
|
||||||
@if (PageState.RenderMode == RenderModes.Interactive || ModuleState.RenderMode == RenderModes.Static)
|
@if (PageState.RenderMode == RenderModes.Interactive || ModuleState.RenderMode == RenderModes.Interactive)
|
||||||
{
|
{
|
||||||
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" />
|
<StreamRenderingDisabled ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" />
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, PageState.Site.Prerender)" />
|
<StreamRenderingEnabled ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" />
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
// this component is on the static side of the render mode boundary
|
// this component is on the static side of the render mode boundary
|
||||||
// it passes state as serializable parameters across the boundary
|
// it passes state as serializable parameters across the boundary
|
||||||
// this enables the state to be used by downstream interactive components
|
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
// this component is on the interactive side of the render mode boundary
|
||||||
|
// it receives state as serializable parameters so that the state can be made available to downstream components
|
||||||
|
|
||||||
private Type ModuleType { get; set; }
|
private Type ModuleType { get; set; }
|
||||||
RenderFragment DynamicComponent { get; set; }
|
RenderFragment DynamicComponent { get; set; }
|
||||||
|
|
||||||
|
|
21
Oqtane.Client/UI/StreamRenderingDisabled.razor
Normal file
21
Oqtane.Client/UI/StreamRenderingDisabled.razor
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
@attribute [StreamRendering(false)]
|
||||||
|
|
||||||
|
@if (PageState.RenderMode == RenderModes.Interactive || ModuleState.RenderMode == RenderModes.Static)
|
||||||
|
{
|
||||||
|
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, PageState.Site.Prerender)" />
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public SiteState SiteState { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public PageState PageState { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Module ModuleState { get; set; }
|
||||||
|
}
|
21
Oqtane.Client/UI/StreamRenderingEnabled.razor
Normal file
21
Oqtane.Client/UI/StreamRenderingEnabled.razor
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
@attribute [StreamRendering(true)]
|
||||||
|
|
||||||
|
@if (PageState.RenderMode == RenderModes.Interactive || ModuleState.RenderMode == RenderModes.Static)
|
||||||
|
{
|
||||||
|
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RenderModeBoundary ModuleState="@ModuleState" PageState="@PageState" SiteState="@SiteState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, PageState.Site.Prerender)" />
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public SiteState SiteState { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public PageState PageState { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Module ModuleState { get; set; }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user