From 4e3b21d0d413ebba6db853fefd40937e0a6f1bee Mon Sep 17 00:00:00 2001 From: Simon Ziegler Date: Thu, 29 Feb 2024 10:59:19 +0000 Subject: [PATCH 1/2] Fix bug --- Material.Blazor/Foundation/ComponentFoundation.cs | 10 +++++++++- Material.Blazor/Foundation/InputComponent.cs | 4 +++- Material.Blazor/Foundation/SingleSelectComponent.cs | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Material.Blazor/Foundation/ComponentFoundation.cs b/Material.Blazor/Foundation/ComponentFoundation.cs index 5d9e331a3..1761b29f1 100644 --- a/Material.Blazor/Foundation/ComponentFoundation.cs +++ b/Material.Blazor/Foundation/ComponentFoundation.cs @@ -66,6 +66,12 @@ public abstract class ComponentFoundation : ComponentBase, IDisposable private protected ConditionalCssClasses ConditionalCssClasses { get; } = new ConditionalCssClasses(); + /// + /// Allows to run for the next render only. + /// + private protected bool AllowNextOnAfterRenderAsync { get; set; } = false; + + /// /// The concurrent queue for javascript interop actions. /// @@ -328,10 +334,12 @@ protected sealed override void OnAfterRender(bool firstRender) /// protected override Task OnAfterRenderAsync(bool firstRender) { - if (firstRender) + if (firstRender || AllowNextOnAfterRenderAsync) { try { + AllowNextOnAfterRenderAsync = false; + if (ParentDialog != null && !ParentDialog.HasInstantiated) { ParentDialog.RegisterLayoutAction(this); diff --git a/Material.Blazor/Foundation/InputComponent.cs b/Material.Blazor/Foundation/InputComponent.cs index 45d6daa76..0d60d56a8 100644 --- a/Material.Blazor/Foundation/InputComponent.cs +++ b/Material.Blazor/Foundation/InputComponent.cs @@ -85,6 +85,7 @@ public abstract class InputComponent : ComponentFoundation ///// private bool AllowNextRenderOnce { get; set; } = false; + /// /// Gets a string that indicates the status of the field being edited. This will include /// some combination of "modified", "valid", or "invalid", depending on the status of the field. @@ -106,9 +107,10 @@ private protected void AllowAllRenders() #region AllowNextRender - private protected void AllowNextRender() + private protected void AllowNextRender(bool allowNextOnAfterRenderAsync = false) { AllowNextRenderOnce = true; + AllowNextOnAfterRenderAsync = allowNextOnAfterRenderAsync; } #endregion diff --git a/Material.Blazor/Foundation/SingleSelectComponent.cs b/Material.Blazor/Foundation/SingleSelectComponent.cs index dbc1f6640..de501d811 100644 --- a/Material.Blazor/Foundation/SingleSelectComponent.cs +++ b/Material.Blazor/Foundation/SingleSelectComponent.cs @@ -60,7 +60,7 @@ protected override async Task OnParametersSetAsync() } } - AllowNextRender(); + AllowNextRender(true); await InvokeAsync(StateHasChanged).ConfigureAwait(false); } } From 5c41ea926399f0ee1607f8f1b45423ab5e0b121f Mon Sep 17 00:00:00 2001 From: Simon Ziegler Date: Thu, 29 Feb 2024 11:02:01 +0000 Subject: [PATCH 2/2] Release notes --- ReleaseNotes.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 152a4fa58..8f7b12f48 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -4,6 +4,25 @@ title: ReleaseNotes --- # Release Notes +#### [5.1.4](https://github.com/Material-Blazor/Material.Blazor/tree/5.1.4) + +Released 2024-02-29 + +**Updates** +- Fixed bug in single select components where updates to the item list would not allow items added to the list to be selected. + +**New components** + +**New features** + +**Breaking Changes** + +**Deprecated Components** + +**Known issues** + +
+ #### [5.1.3](https://github.com/Material-Blazor/Material.Blazor/tree/5.1.3) Released 2024-02-21