diff --git a/Directory.Build.props b/Directory.Build.props index 7cc0fdfb4..cb6dceb14 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ Steven T. Cramer TimeWarp State - 11.0.0-beta.52+8.0.303 + 11.0.0-beta.53+8.0.303 https://timewarpengineering.github.io/blazor-state/ TimeWarp.State; TimeWarp-State; TimeWarpState; BlazorState; Blazor; State; Blazor-State; MediatR; Mediator; Pipeline; Redux; Flux Logo.png diff --git a/Source/TimeWarp.State/Components/ITimeWarpStateComponent.cs b/Source/TimeWarp.State/Components/ITimeWarpStateComponent.cs index 16471b2f0..e28508e65 100644 --- a/Source/TimeWarp.State/Components/ITimeWarpStateComponent.cs +++ b/Source/TimeWarp.State/Components/ITimeWarpStateComponent.cs @@ -25,4 +25,6 @@ public interface ITimeWarpStateComponent string Id { get; } void ReRender(); + + bool ShouldReRender(Type type) => true; } diff --git a/Source/TimeWarp.State/Subscriptions.cs b/Source/TimeWarp.State/Subscriptions.cs index bcb39a995..27f9bc17e 100644 --- a/Source/TimeWarp.State/Subscriptions.cs +++ b/Source/TimeWarp.State/Subscriptions.cs @@ -87,7 +87,11 @@ public void ReRenderSubscribers(Type type) IEnumerable subscriptions = TimeWarpStateComponentReferencesList.Where(record => record.StateType == type); foreach (Subscription subscription in subscriptions) { - if (subscription.TimeWarpStateComponentReference.TryGetTarget(out ITimeWarpStateComponent? target)) + if + ( + subscription.TimeWarpStateComponentReference.TryGetTarget(out ITimeWarpStateComponent? target) + && target.ShouldReRender(type) + ) { LogReRender(subscription); target.ReRender();