Skip to content

A low-boilerplate Flux/Redux state library for Blazor

License

Notifications You must be signed in to change notification settings

umitkavala/blazor-fluxor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazor-Fluxor

Blazor-Fluxor is a zero boilerplate Flux/Redux library for the new Microsoft aspdotnet Blazor project.

The aim of Fluxor is to create a single-state store approach to front-end development in Blazor without the headaches typically associated with other implementations, such as the overwhelming amount of boiler-plate code required just to add a very basic feature.

Installation

You can download the latest release / pre-release NuGet packages from the official Blazor-Fluxor nuget page.

Getting started

The easiest way to get started is to look at the Sample projects. They are numbered in an order recommended for learning Blazor-Fluxor. Each will have a readme file that explains how the sample was created.

Sample projects

More sample projects will be added as the framework develops.

  • Counter sample - Fluxorizes Counter page in the standard Visual Studio Blazor sample in order to show how to switch to a Redux/Flux pattern application using Fluxor.
  • Effects sample - Fluxorizes FetchData page in the standard Visual Studio Blazor sample in order to demonstrate asynchronous reactions to actions that are dispatched.
  • Redux dev tools integration - Demonstrates how to enable debugger integration for the [Redux dev tools] Chrome plugin.
  • Custom Middleware - Demonstrates how to create custom Middleware to intercept actions etc.
  • Blazor Flight Finder - A conversion of the official Blazor Flight Finder demo.

What's new

New in 0.25.0

  • Remove IAction. Actions may now be any type of object.

New in 0.24.0

NOTE: Due to a bug in System.Text.Json the ReduxDevTools do not work in this release.

  • Upgraded to latest packages (.net core v3.0.0-preview6.19307.2)

New in 0.23.0

  • Upgraded to latest packages (.net core v3.0.0-preview5-19227-01)

New in 0.22.0

  • Upgraded to latest packages (.net core v3.0.0-preview4-19216-03)
  • Rename *.cshtml to *.razor
  • Change project start up code to reflect most recent approach

New in 0.21.0

  • Upgraded to latest packages (.net core v3.0.0-preview3-19153-02)

New in 0.20.0

  • Upgraded to Blazor 0.9.0

New in 0.19.0

New in 0.18.0

  • Changed UseDependencyInjection to use AddScoped instead of AddSingleton so server-side Blazor apps do not share the same store across clients.

New in 0.17.0

  • Upgraded to Blazor 0.7.0

New in 0.16.0

  • Upgraded to Blazor 0.6.0
  • Added a Task to IStore named Initialized that can be awaited in OnInitAsync

New in 0.15.1

  • Added setTimeout workaround because Blazor won't allow calling StateHasChanged when the page loads

New in 0.15.0

  • Queue dispatched actions until store is initialized and then dequeue them.
  • Made demos reference NuGet packages so they can be downloaded separately.

Issues fixed

New in 0.14.0

  • Upgraded to Blazor 0.5.1.
  • Effects and Middlewares must now call IDispatcher.Dispatch() to dispatch actions.

New in 0.13.0

  • Added state change observer pattern. Calling SomeInjectedState.Changed(this, StateHasChanged) in a component's OnInit method will subscribe to all state changes triggered by other components.
  • Changed IState.Current to IState.Value
  • Modified the official Blazor Flight Finder demo to use Fluxor. Status is incomplete but functional.

New in 0.12.1

  • Changed the way Effects and Reducers work so the developer has more flexibility in chosing what they react to (descendant classes, implemented interfaces, etc)

New in 0.12.0

  • Added unit tests
  • Change versioning scheme to match the Blazor approach (increment minor version per release)
  • Make BrowserInterop an injected service
  • Ensure DisposableCallback can only be disposed once
  • Change Store.Features from IEnumerable to IReadonlyDictionary<string, Feature> for fast lookup and prevention of duplicate keys
  • Make Store.BeginInternalMiddlewareChange re-entrant
  • Fix NullReferenceException that could occur when Middleware returned null from IMiddleware.AfterDispatch

New in 0.0.11

  • Allow middleware to return tasks to dispatch from IMiddleware.AfterDispatch
  • Make methods of Feature<TState> virtual.
  • Upgraded to Blazor 0.4.0

New in 0.0.10

  • Introduced IDispatcher for dispatching actions from Blazor components so that the whole IStore isn't required.
  • Introduced IState for providing feature state to Blazor components so that the entire IFeature doesn't need to be referenced.

New in 0.0.9

  • Renamed Handle to HandleAsync in effects
  • Added source docs

New in 0.0.8

  • Added an example showing how to create Middleware modules for Fluxor
  • Fixed a bug where components were not displaying state updates when actions effecting their state were dispatched from another component

New in 0.0.7

  • Renamed IStoreMiddleware to IMiddleware
  • Allow middleware to veto the dispatching of actions
  • Allow middleware to declare Javascript it needs to be added into the site's html page
  • Add routing middleware
  • Exclude auto-discovery of features / reducers / effects in namespaces that contain a class that implements IMiddleware
  • Auto register features / reducers / effects for classes in the same namespace (or below) of any class added with Options.AddMiddleware

New in 0.0.6

  • Changed the signature of IStore.Dispatch to IStore.DispatchAsync
  • Upgraded to latest version of Blazor (0.3.0)

New in 0.0.5

  • Changed the signature of ServiceCollection.AddFluxor to pass in an Options object
  • Added support for Redux Dev Tools
  • Added support for adding custom Middleware

New in 0.0.4

  • Changed side-effects to return an array of actions to dispatch rather than limiting it to a single action

New in 0.0.3

  • Added side-effects for calling out to async routines such as HTTP requests
  • Added a sample application to the Sample projects

New in 0.0.2

  • Automatic discovery of store, features, and reducers via dependency injection.

New in 0.0.1

  • Basic store / feature / reducer implementation

Licence

MIT

About

A low-boilerplate Flux/Redux state library for Blazor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%