Fluxor.Blazor.Persistence
1.1.0
See the version list below for details.
dotnet add package Fluxor.Blazor.Persistence --version 1.1.0
NuGet\Install-Package Fluxor.Blazor.Persistence -Version 1.1.0
<PackageReference Include="Fluxor.Blazor.Persistence" Version="1.1.0" />
paket add Fluxor.Blazor.Persistence --version 1.1.0
#r "nuget: Fluxor.Blazor.Persistence, 1.1.0"
// Install Fluxor.Blazor.Persistence as a Cake Addin #addin nuget:?package=Fluxor.Blazor.Persistence&version=1.1.0 // Install Fluxor.Blazor.Persistence as a Cake Tool #tool nuget:?package=Fluxor.Blazor.Persistence&version=1.1.0
blazor-fluxor-persistence
Fluxor state persistence for web blazor application using LocalStorage. Currently supports LocalStorage only.
Usage
In Program.cs file Add UsePersistence to FluxorOptions
Install Fluxor.Blazor.Persistence
Add below code to the program.cs file
builder.Services
.AddFluxor(o =>
{
o.ScanAssemblies(typeof(Program).Assembly)
.UseRouting()
.UsePersistence();
});
Exceptions
Any exception thrown when loading/saving the persist state are added to `StatePersistenceFailureState' This errors can be retrieved from state
This exceptions are cleared on browser refresh or close. The exceptions can also be cleared by dispatching action
e.g. Razor component 'StateErrors.razor'
@page "/persist-state-errors"
@inherits FluxorComponent
@using Fluxor.Blazor.Persistence.Store
@inject IState<StatePersistenceFailureState> State
@inject IDispatcher Dispatcher;
<h3>Errors</h3>
@if (State.Value.Errors.Count == 0)
{
<div>No Errors</div>
}
else
{
@foreach(var e in State.Value.Errors)
{
<div class="row">
<span class="col1">@e.ActionType</span>
<span class="col2">@e.FeatureName</span>
<span class="col3">@e.Exception?.Message</span>
</div>
}
<button class="btn btn-outline" @onclick="ClearErrors">Clear Errors</button>
}
@code {
protected override void OnInitialized()
{
base.OnInitialized();
}
public void ClearErrors()
{
Dispatcher.Dispatch(new ClearStatePersistenceFailureStateAction());
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Blazored.LocalStorage (>= 4.4.0)
- Fluxor (>= 5.9.1)
- Fluxor.Blazor.Web (>= 5.9.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.