Fluxor.Blazor.Persistence 1.1.0

There is a newer version of this package available.
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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fluxor.Blazor.Persistence" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fluxor.Blazor.Persistence --version 1.1.0
#r "nuget: Fluxor.Blazor.Persistence, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.3 136 10/10/2023
1.2.2 115 10/4/2023
1.2.1 120 10/3/2023
1.2.0 99 9/28/2023
1.1.0 106 9/27/2023