Releases: le-nn/memento
v1.7.0 API improvements
What's Changed
- API Improvements
Stopped covariance of IStore<object, object> and made IStore an interface.
Changed the TMessage constraint from class to notnull in Store<TState, TMessage>.
Changed the class that notifies state changes from AbstractStore to derive from the more general StateObservable.
https://github.com/le-nn/memento/blob/main/src/Memento.Core/StateObservable.cs
-
Add StateChangedObserver Componet to observe state changes when you cannot to inherits ObserverComopnent
https://github.com/le-nn/memento/blob/main/src/Memento.Blazor/StateChangedObserver.cs -
Ended support for .NET6 and .NET7
Full Changelog: v1.6.0...v1.7.0
v1.6.0 .NET 8 support
v1.5.0
v1.4.1 Add Support for selecting Service type of Singletone or Scoped
Add Support for selecting Service type of Singletone or Scoped
The registration to the service used to be AddScoped, but now you can choose between Singleton and Scoped.
If isScoped: false
, it will be registered as a Singleton, if isScoped: true
, it will be registered as a Scoped service.
In the case of Blazor Server, the state is separated for each user session, so the argument isScoped: true
must be set or the state will be shared by all users.
The default args is isScoped: true
.
using Memento.Blazor;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services
// Add necessary modules to Memento
.AddMemento(isScoped: false)
// Add middleware
.AddMiddleware<LoggerMiddleware>(isScoped: false)
// Add by specifying Store
.AddStore<AsyncCounterStore>(isScoped: false)
// Scan the assembly and register all classes that implement the IStore interface
.ScanAssemblyAndAddStores(typeof(Program).Assembly, isScoped: false);
await builder.Build().RunAsync();
Full Changelog: v1.4.0...v1.4.1
v1.4.0
What's Changed
- support redux devtools and adjusts namespace (Fix #4) by @le-nn in #15
- Support HandleDisposable on Store and ObserverComponent that realizes handling IDisposable. Generated disposables will be Disposed when the component is destroyed.
Express Subscribing of Events declaratively and safely.
Overrides on ObserverComponent or Store<>
An example on Store
protected override IEnumerable<IDisposable> OnHandleDisposable() {
yield return _loading.Subscribe(e => {
Mutate(state => state with { LoadingState = e, });
});
}
Full Changelog: v1.3.1...v1.4.0
v1.3.1
What's Changed
- Feature/basic store pattern by @le-nn in #12
- Feature/state has changed by @le-nn in #13
- Fix some typos
- Add Support for ReduxDevTools
Change Store APIs
- Change RootState Type from ImmutableDictionary to Dictionary
- Change Store to FluxStore
- Using the AbstractStore class as the base class