diff --git a/README.md b/README.md index 3b3fccf..278c931 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ If you have ReduxDevTool installed, DevTool will launch automatically. You can do state history and time travel. +# Documentation + +https://le-nn.github.io/memento/docs/README.html + ## React or TS/JS bindings Currently, moved to here @@ -166,10 +170,6 @@ Blazor view in Razor ``` -# Documentation - -[See](./docs/README.md) - # License Designed with ♥ by le-nn. Licensed under the MIT License. diff --git a/docs/Assets/Architecture.jpg b/docs/Assets/Architecture.jpg new file mode 100644 index 0000000..a17b611 Binary files /dev/null and b/docs/Assets/Architecture.jpg differ diff --git a/docs/BasicConcept.md b/docs/BasicConcept.md index a9ea1b9..44eb0a7 100644 --- a/docs/BasicConcept.md +++ b/docs/BasicConcept.md @@ -578,4 +578,4 @@ Applying these methods makes application state management scalable and maintaina In the Next tutorial you will learn how to update the actual UI in Blazor ! -[See](./Blazor/README.md) +[See](./Blazor.md) diff --git a/docs/README.md b/docs/README.md index b575495..2f308c6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -49,12 +49,12 @@ You can do state history and time travel. ## Samples -[C# with Console App](../samples/Memento.Sample.ConsoleApp) +[C# with Console App](https://github.com/le-nn/memento/tree/main/samples/Memento.Sample.ConsoleApp) -[Blazor App Shared](../samples/Memento.Sample.Blazor) +[Blazor App Shared](https://github.com/le-nn/memento/tree/main/samples) -[Blazor Wasm App](../samples/Memento.Sample.BlazorWasm) +[Blazor Wasm App](https://github.com/le-nn/memento/tree/main/samples) -[Blazor Server App](../samples/Memento.Sample.BlazorServer) +[Blazor Server App](https://github.com/le-nn/memento/tree/main/samples) diff --git a/samples/Memento.Sample.Blazor/Shared/NavMenu.razor b/samples/Memento.Sample.Blazor/Shared/NavMenu.razor index 1d8b77a..22a277b 100644 --- a/samples/Memento.Sample.Blazor/Shared/NavMenu.razor +++ b/samples/Memento.Sample.Blazor/Shared/NavMenu.razor @@ -47,7 +47,7 @@ diff --git a/src/Memento.Blazor/ObserverComponent.cs b/src/Memento.Blazor/ObserverComponent.cs index d6391f3..d46ee80 100644 --- a/src/Memento.Blazor/ObserverComponent.cs +++ b/src/Memento.Blazor/ObserverComponent.cs @@ -1,4 +1,5 @@ using Memento.Core.Executors; +using Memento.Core; using Microsoft.AspNetCore.Components; using System.Collections.Concurrent; @@ -6,7 +7,7 @@ namespace Memento.Blazor; /// /// The base class for components that observe state changes in a store. -/// Injected stores that implement the interface will all be subscribed to state change events +/// Injected stores that implement the interface will all be subscribed to state change events /// and automatically call . /// public class ObserverComponent : ComponentBase, IDisposable { diff --git a/src/Memento.Blazor/StateSubscriber.cs b/src/Memento.Blazor/StateSubscriber.cs index 6f40b2e..5a06a27 100644 --- a/src/Memento.Blazor/StateSubscriber.cs +++ b/src/Memento.Blazor/StateSubscriber.cs @@ -16,12 +16,12 @@ public static class StateSubscriber { private static readonly ConcurrentDictionary> _valueDelegatesByType = new(); /// - /// Subscribes to all properties on the specified + /// Subscribes to all properties on the specified /// to ensure is called whenever a state is modified /// - /// The object to scan for properties. + /// The object to scan for properties. /// The action to execute when one of the states are modified - /// + /// An object representing the subscription. Dispose this object to unsubscribe. public static IDisposable Subscribe(object subject, Action callback) { _ = subject ?? throw new ArgumentNullException(nameof(subject)); _ = callback ?? throw new ArgumentNullException(nameof(callback)); @@ -60,4 +60,4 @@ from currentProperty in GetStateChangedNotifierProperties(type) x => (TStateObservable)stronglyTypedDelegate.DynamicInvoke(x)! ) ); -} \ No newline at end of file +} diff --git a/src/Memento.Core/AbstractStore.cs b/src/Memento.Core/AbstractStore.cs index 0dadd1b..3244419 100644 --- a/src/Memento.Core/AbstractStore.cs +++ b/src/Memento.Core/AbstractStore.cs @@ -71,15 +71,6 @@ public void Dispose() { OnDisposed(); } - /// - /// Handles disposable resources of the store. - /// - /// An enumerable of disposable resources. - [Obsolete] - protected virtual IEnumerable OnHandleDisposable() { - return []; - } - /// /// Subscribes to the store with the provided observer. /// @@ -255,10 +246,6 @@ protected void AddDisposable(IEnumerable disposable) { async ValueTask IStore.InitializeAsync(StoreProvider provider) { _provider = provider; - foreach (var item in OnHandleDisposable()) { - _disposables.Add(item); - } - try { await OnInitializedAsync(); } diff --git a/src/Memento.Core/MementoStore.cs b/src/Memento.Core/MementoStore.cs index d08c002..e4611b9 100644 --- a/src/Memento.Core/MementoStore.cs +++ b/src/Memento.Core/MementoStore.cs @@ -15,7 +15,7 @@ HistoryManager historyManager /// The current state. /// The StateHasChanged command to apply. /// The new state after applying the command. - static TState Reducer(TState state, TMessage message) { + static TState Reducer(TState state, TMessage? message) { return state; } diff --git a/src/Memento.Core/StateChangedEventArgs.cs b/src/Memento.Core/StateChangedEventArgs.cs index 259e3ac..2cb87ac 100644 --- a/src/Memento.Core/StateChangedEventArgs.cs +++ b/src/Memento.Core/StateChangedEventArgs.cs @@ -58,11 +58,6 @@ public record StateChangedEventArgs : IStateChangedEventArgs { public interface IStateChangedEventArgs : IStateChangedEventArgs where TState : class where TMessage : notnull { - /// - /// Gets the type of the state change. - /// - StateChangeType StateChangeType { get; } - /// /// Gets the last state before the change. /// diff --git a/src/Memento.ReduxDevTool/ReduxDevToolMiddlewareHandler.cs b/src/Memento.ReduxDevTool/ReduxDevToolMiddlewareHandler.cs index a292cfa..e3e8be4 100644 --- a/src/Memento.ReduxDevTool/ReduxDevToolMiddlewareHandler.cs +++ b/src/Memento.ReduxDevTool/ReduxDevToolMiddlewareHandler.cs @@ -51,7 +51,7 @@ public ReduxDevToolMiddlewareHandler(IDevToolInteropHandler devtoolInteropHandle }); } - public override object? HandleStoreDispatch(object? state, object command, NextStoreMiddlewareCallback next) { + public override object? HandleStoreDispatch(object? state, object? command, NextStoreMiddlewareCallback next) { if (_liftedStore.IsJumping) { return next(null, command); } diff --git a/test/Memento.Test/Core/Mock/FluxAsyncCounterStore.cs b/test/Memento.Test/Core/Mock/FluxAsyncCounterStore.cs index e2558f2..d203aec 100644 --- a/test/Memento.Test/Core/Mock/FluxAsyncCounterStore.cs +++ b/test/Memento.Test/Core/Mock/FluxAsyncCounterStore.cs @@ -29,7 +29,7 @@ public class FluxAsyncCounterStore : FluxStore state with { IsLoading = true