From aa9d73b617ca809500f2849e2cc8e886fa602694 Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Mon, 28 Aug 2023 10:34:13 +0700 Subject: [PATCH 1/3] Remove IMediator and IStore from IBlazorStateComponent We use both in BlazorStateComponent but they do NOT need to be in the interface. As nothing that accesses via the interface needs these. --- .../Components/BlazorStateComponent.cs | 2 +- .../Components/IBlazorStateComponent.cs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/BlazorState/Components/BlazorStateComponent.cs b/Source/BlazorState/Components/BlazorStateComponent.cs index 16ca365ae..641c661bd 100644 --- a/Source/BlazorState/Components/BlazorStateComponent.cs +++ b/Source/BlazorState/Components/BlazorStateComponent.cs @@ -33,7 +33,7 @@ public BlazorStateComponent() [Parameter] public string TestId { get; set; } [Inject] public IMediator Mediator { get; set; } - [Inject] public IStore Store { get; set; } + [Inject] private IStore Store { get; set; } /// /// Maintains all components that subscribe to a State. diff --git a/Source/BlazorState/Components/IBlazorStateComponent.cs b/Source/BlazorState/Components/IBlazorStateComponent.cs index c5b523e45..11b48be2d 100644 --- a/Source/BlazorState/Components/IBlazorStateComponent.cs +++ b/Source/BlazorState/Components/IBlazorStateComponent.cs @@ -6,19 +6,23 @@ namespace BlazorState; /// Minimum implementation needed for BlazorState to function /// /// -/// public class BlazorStateComponent : BlazorComponent, +/// public class YourBaseComponent : BlazorComponent, /// IBlazorStateComponent /// { -/// [Inject] public IMediator Mediator { get; set; } -/// [Inject] public IStore Store { get; set; } +/// static readonly ConcurrentDictionary s_InstanceCounts = new(); +/// public BlazorStateComponent() +/// { +/// string name = GetType().Name; +/// int count = s_InstanceCounts.AddOrUpdate(name, 1, (aKey, aValue) => aValue + 1); +/// Id = $"{name}-{count}"; +/// } +/// public string Id { get; } /// public void ReRender() => StateHasChanged(); /// } /// public interface IBlazorStateComponent { string Id { get; } - IMediator Mediator { get; set; } - IStore Store { get; set; } - + void ReRender(); } From 9828b637e81cd980c3d0e1db47a13747f85b7787 Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Mon, 28 Aug 2023 10:48:36 +0700 Subject: [PATCH 2/3] Update Version release and migration docs --- Directory.Build.props | 2 +- Documentation/Migrations/Migration9-10.md | 12 ++++++++++++ Documentation/ReleaseNotes/Release10.0.0.md | 12 ++++++++++++ Documentation/ReleaseNotes/Release7.0.0.md | 2 +- Documentation/ReleaseNotes/Release8.0.0.md | 2 +- Documentation/ReleaseNotes/Release9.0.0.md | 2 +- 6 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 Documentation/Migrations/Migration9-10.md create mode 100644 Documentation/ReleaseNotes/Release10.0.0.md diff --git a/Directory.Build.props b/Directory.Build.props index 81d4dad6f..411d9aaab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ Steven T. Cramer Blazor State - 9.0.1+7.0.400 + 10.0.0+7.0.400 https://timewarpengineering.github.io/blazor-state/ TimeWarp-State; TimeWarpState; BlazorState; Blazor; State; Blazor-State; MediatR; Mediator; Pipeline; Redux; Flux https://github.com/TimeWarpEngineering/blazor-state.git diff --git a/Documentation/Migrations/Migration9-10.md b/Documentation/Migrations/Migration9-10.md new file mode 100644 index 000000000..e4c6733c9 --- /dev/null +++ b/Documentation/Migrations/Migration9-10.md @@ -0,0 +1,12 @@ +--- +uid: BlazorState:Migration7-8.md +title: Migrate From 7.X to 8.X +--- + +# Migration + +## From 9.x to 10.x + +If you were implementing IBlazorStateComponent in your own component. You no longer need to implement IMediator or IStore. + +If you were accessing either of these properties via the IBlazorStateComponent interface you will need to create your own interface to use that implements IBlazorStateComponent plus the properties you need. diff --git a/Documentation/ReleaseNotes/Release10.0.0.md b/Documentation/ReleaseNotes/Release10.0.0.md new file mode 100644 index 000000000..a2986095a --- /dev/null +++ b/Documentation/ReleaseNotes/Release10.0.0.md @@ -0,0 +1,12 @@ +--- +uid: BlazorState:Release.9.0.0.md +title: Release 9.0.0 +--- + +## Release 10.0.0 + +### Breaking Changes + +* IBlazorStateComponent no longer has Mediator or Store properties. + +See [Migrations](xref:BlazorState:Migration9-10.md) for instructions on how to migrate from version 9.0 to 10.0. diff --git a/Documentation/ReleaseNotes/Release7.0.0.md b/Documentation/ReleaseNotes/Release7.0.0.md index 122e442f2..461a18830 100644 --- a/Documentation/ReleaseNotes/Release7.0.0.md +++ b/Documentation/ReleaseNotes/Release7.0.0.md @@ -9,4 +9,4 @@ title: Release 7.0.0 * Blazor-State now requires dotnet 7 -See [Migrations](xref:BlazorState:Migration6-7.md) for instructions on how to migrate from version 6.0.0 to 7.0.0. +See [Migrations](xref:BlazorState:Migration6-7.md) for instructions on how to migrate from version 6.0 to 7.0. diff --git a/Documentation/ReleaseNotes/Release8.0.0.md b/Documentation/ReleaseNotes/Release8.0.0.md index 3c9c6313d..12c7e43d2 100644 --- a/Documentation/ReleaseNotes/Release8.0.0.md +++ b/Documentation/ReleaseNotes/Release8.0.0.md @@ -9,7 +9,7 @@ title: Release 8.0.0 * Blazor-State now requires MediatR version 12 -See [Migrations](xref:BlazorState:Migration7-8.md) for instructions on how to migrate from version 7.0.0 to 8.0.0. +See [Migrations](xref:BlazorState:Migration7-8.md) for instructions on how to migrate from version 7.0 to 8.0. ### Other Changes diff --git a/Documentation/ReleaseNotes/Release9.0.0.md b/Documentation/ReleaseNotes/Release9.0.0.md index 1ce2a0bf6..2cb9f5271 100644 --- a/Documentation/ReleaseNotes/Release9.0.0.md +++ b/Documentation/ReleaseNotes/Release9.0.0.md @@ -9,7 +9,7 @@ title: Release 9.0.0 * Blazor-State now requires MediatR version 12.1.1 which actually should have been a breaking change on MediatR. -See [Migrations](xref:BlazorState:Migration8-9.md) for instructions on how to migrate from version 7.0.0 to 8.0.0. +See [Migrations](xref:BlazorState:Migration8-9.md) for instructions on how to migrate from version 8.0 to 9.0. ### Other Changes From 7598bd25716239734c73b0ceabedc13365377c0f Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Mon, 28 Aug 2023 10:52:25 +0700 Subject: [PATCH 3/3] Clean up realase and migration docs --- Documentation/Migrations/Migration8-9.md | 4 ++-- Documentation/Migrations/Migration9-10.md | 4 ++-- Documentation/ReleaseNotes/Release10.0.0.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/Migrations/Migration8-9.md b/Documentation/Migrations/Migration8-9.md index 1bfaecc35..1f7eaed65 100644 --- a/Documentation/Migrations/Migration8-9.md +++ b/Documentation/Migrations/Migration8-9.md @@ -1,6 +1,6 @@ --- -uid: BlazorState:Migration7-8.md -title: Migrate From 7.X to 8.X +uid: BlazorState:Migration8-9.md +title: Migrate From 8.X to 9.X --- # Migration diff --git a/Documentation/Migrations/Migration9-10.md b/Documentation/Migrations/Migration9-10.md index e4c6733c9..a44948357 100644 --- a/Documentation/Migrations/Migration9-10.md +++ b/Documentation/Migrations/Migration9-10.md @@ -1,6 +1,6 @@ --- -uid: BlazorState:Migration7-8.md -title: Migrate From 7.X to 8.X +uid: BlazorState:Migration9-10.md +title: Migrate From 9.X to 10.X --- # Migration diff --git a/Documentation/ReleaseNotes/Release10.0.0.md b/Documentation/ReleaseNotes/Release10.0.0.md index a2986095a..5f5c04d29 100644 --- a/Documentation/ReleaseNotes/Release10.0.0.md +++ b/Documentation/ReleaseNotes/Release10.0.0.md @@ -1,6 +1,6 @@ --- -uid: BlazorState:Release.9.0.0.md -title: Release 9.0.0 +uid: BlazorState:Release.10.0.0.md +title: Release 10.0.0 --- ## Release 10.0.0