From 9ca286007977765e04633778896b4e1d411318fe Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 15 Aug 2025 20:07:05 +0200 Subject: [PATCH] Fixed resetting bug in assistants (#535) --- .../Components/DebouncedTextField.razor.cs | 15 +++++++++++++++ .../wwwroot/changelog/v0.9.51.md | 1 + 2 files changed, 16 insertions(+) diff --git a/app/MindWork AI Studio/Components/DebouncedTextField.razor.cs b/app/MindWork AI Studio/Components/DebouncedTextField.razor.cs index 885a8488..a1fd256b 100644 --- a/app/MindWork AI Studio/Components/DebouncedTextField.razor.cs +++ b/app/MindWork AI Studio/Components/DebouncedTextField.razor.cs @@ -50,12 +50,14 @@ public partial class DebouncedTextField : MudComponentBase private readonly Timer debounceTimer = new(); private string text = string.Empty; + private string lastParameterText = string.Empty; #region Overrides of ComponentBase protected override async Task OnInitializedAsync() { this.text = this.Text; + this.lastParameterText = this.Text; this.debounceTimer.AutoReset = false; this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds; this.debounceTimer.Elapsed += (_, _) => @@ -68,6 +70,19 @@ public partial class DebouncedTextField : MudComponentBase await base.OnInitializedAsync(); } + + protected override void OnParametersSet() + { + // Only sync when the parent's parameter actually changed since the last change: + if (this.Text != this.lastParameterText) + { + this.text = this.Text; + this.lastParameterText = this.Text; + + this.debounceTimer.Stop(); + this.debounceTimer.Start(); + } + } #endregion diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md index b80ec417..ef784978 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.51.md @@ -1 +1,2 @@ # v0.9.51, build 226 (2025-08-xx xx:xx UTC) +- Fixed a bug in various assistants where some text fields were not reset when resetting. \ No newline at end of file