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.
You can download the latest release / pre-release NuGet packages from the official Blazor-Fluxor nuget page.
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.
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.
- Remove IAction. Actions may now be any type of object.
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)
- Upgraded to latest packages (.net core v3.0.0-preview5-19227-01)
- 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
- Upgraded to latest packages (.net core v3.0.0-preview3-19153-02)
- Upgraded to Blazor 0.9.0
- Upgraded to Blazor 0.8.0 (Thanks to @chris_sainty on Twitter)
- Changed UseDependencyInjection to use
AddScoped
instead ofAddSingleton
so server-side Blazor apps do not share the same store across clients.
- Upgraded to Blazor 0.7.0
- Upgraded to Blazor 0.6.0
- Added a Task to IStore named
Initialized
that can be awaited inOnInitAsync
- Added setTimeout workaround because Blazor won't allow calling StateHasChanged when the page loads
- Queue dispatched actions until store is initialized and then dequeue them.
- Made demos reference NuGet packages so they can be downloaded separately.
Issues fixed
- Upgraded to Blazor 0.5.1.
- Effects and Middlewares must now call
IDispatcher.Dispatch()
to dispatch actions.
- Added state change observer pattern. Calling
SomeInjectedState.Changed(this, StateHasChanged)
in a component'sOnInit
method will subscribe to all state changes triggered by other components. - Changed
IState.Current
toIState.Value
- Modified the official Blazor
Flight Finder
demo to use Fluxor. Status is incomplete but functional.
- Changed the way Effects and Reducers work so the developer has more flexibility in chosing what they react to (descendant classes, implemented interfaces, etc)
- 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
- Allow middleware to return tasks to dispatch from IMiddleware.AfterDispatch
- Make methods of
Feature<TState>
virtual. - Upgraded to Blazor 0.4.0
- 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.
- Renamed
Handle
toHandleAsync
in effects - Added source docs
- 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
- 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
- Changed the signature of IStore.Dispatch to IStore.DispatchAsync
- Upgraded to latest version of Blazor (0.3.0)
- Changed the signature of ServiceCollection.AddFluxor to pass in an Options object
- Added support for Redux Dev Tools
- Added support for adding custom Middleware
- Changed side-effects to return an array of actions to dispatch rather than limiting it to a single action
- Added side-effects for calling out to async routines such as HTTP requests
- Added a sample application to the Sample projects
- Automatic discovery of store, features, and reducers via dependency injection.
- Basic store / feature / reducer implementation
MIT