Skip to content

Commit

Permalink
Fix broken links and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rdghm1234 committed Feb 19, 2024
1 parent 3f6276f commit 749714b
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 36 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -166,10 +170,6 @@ Blazor view in Razor
```

# Documentation

[See](./docs/README.md)

# License

Designed with ♥ by le-nn. Licensed under the MIT License.
Binary file added docs/Assets/Architecture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/BasicConcept.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


2 changes: 1 addition & 1 deletion samples/Memento.Sample.Blazor/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>

<div class="nav-item px-3">
<NavLink class="nav-link" href="docs">
<NavLink class="nav-link" href="https://le-nn.github.io/memento/docs/README.html">
<span class="oi oi-list-rich" aria-hidden="true"></span>Docs
</NavLink>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/Memento.Blazor/ObserverComponent.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Memento.Core.Executors;
using Memento.Core;
using Microsoft.AspNetCore.Components;
using System.Collections.Concurrent;

namespace Memento.Blazor;

/// <summary>
/// The base class for components that observe state changes in a store.
/// Injected stores that implement the <see cref="IStore"/> interface will all be subscribed to state change events
/// Injected stores that implement the <see cref="IStateObservable{TMessage}"/> interface will all be subscribed to state change events
/// and automatically call <see cref="ComponentBase.StateHasChanged"/>.
/// </summary>
public class ObserverComponent : ComponentBase, IDisposable {
Expand Down
8 changes: 4 additions & 4 deletions src/Memento.Blazor/StateSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public static class StateSubscriber {
private static readonly ConcurrentDictionary<Type, IEnumerable<GetStateChangedPropertyDelegate>> _valueDelegatesByType = new();

/// <summary>
/// Subscribes to all <see cref="IStateChangedNotifier"/> properties on the specified <paramref name="subject"/>
/// Subscribes to all <see cref="IStateObservable<object>"/> properties on the specified <paramref name="subject"/>
/// to ensure <paramref name="callback"/> is called whenever a state is modified
/// </summary>
/// <param name="subject">The object to scan for <see cref="IStateChangedNotifier"/> properties.</param>
/// <param name="subject">The object to scan for <see cref="IStateObservable<object>"/> properties.</param>
/// <param name="callback">The action to execute when one of the states are modified</param>
/// <returns></returns>
/// <returns>An <see cref="IDisposable"/> object representing the subscription. Dispose this object to unsubscribe.</returns>
public static IDisposable Subscribe(object subject, Action<IStateChangedEventArgs> callback) {
_ = subject ?? throw new ArgumentNullException(nameof(subject));
_ = callback ?? throw new ArgumentNullException(nameof(callback));
Expand Down Expand Up @@ -60,4 +60,4 @@ from currentProperty in GetStateChangedNotifierProperties(type)
x => (TStateObservable)stronglyTypedDelegate.DynamicInvoke(x)!
)
);
}
}
13 changes: 0 additions & 13 deletions src/Memento.Core/AbstractStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ public void Dispose() {
OnDisposed();
}

/// <summary>
/// Handles disposable resources of the store.
/// </summary>
/// <returns>An enumerable of disposable resources.</returns>
[Obsolete]
protected virtual IEnumerable<IDisposable> OnHandleDisposable() {
return [];
}

/// <summary>
/// Subscribes to the store with the provided observer.
/// </summary>
Expand Down Expand Up @@ -255,10 +246,6 @@ protected void AddDisposable(IEnumerable<IDisposable> disposable) {
async ValueTask IStore.InitializeAsync(StoreProvider provider) {
_provider = provider;

foreach (var item in OnHandleDisposable()) {
_disposables.Add(item);
}

try {
await OnInitializedAsync();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Memento.Core/MementoStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ HistoryManager historyManager
/// <param name="state">The current state.</param>
/// <param name="message">The StateHasChanged command to apply.</param>
/// <returns>The new state after applying the command.</returns>
static TState Reducer(TState state, TMessage message) {
static TState Reducer(TState state, TMessage? message) {
return state;
}

Expand Down
5 changes: 0 additions & 5 deletions src/Memento.Core/StateChangedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ public record StateChangedEventArgs : IStateChangedEventArgs {
public interface IStateChangedEventArgs<out TState, out TMessage> : IStateChangedEventArgs
where TState : class
where TMessage : notnull {
/// <summary>
/// Gets the type of the state change.
/// </summary>
StateChangeType StateChangeType { get; }

/// <summary>
/// Gets the last state before the change.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Memento.ReduxDevTool/ReduxDevToolMiddlewareHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/Memento.Test/Core/Mock/FluxAsyncCounterStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FluxAsyncCounterStore : FluxStore<FluxAsyncCounterState, FluxAsyncC

// State can change via Reducer and easy to observe state from command
// Reducer generate new state from command and current state
static FluxAsyncCounterState Reducer(FluxAsyncCounterState state, FluxAsyncCounterCommands command) {
static FluxAsyncCounterState Reducer(FluxAsyncCounterState state, FluxAsyncCounterCommands? command) {
return command switch {
BeginLoading => state with {
IsLoading = true
Expand Down

0 comments on commit 749714b

Please sign in to comment.