Skip to content

Commit 9ca2860

Browse files
Fixed resetting bug in assistants (#535)
1 parent 28b470f commit 9ca2860

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

app/MindWork AI Studio/Components/DebouncedTextField.razor.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ public partial class DebouncedTextField : MudComponentBase
5050

5151
private readonly Timer debounceTimer = new();
5252
private string text = string.Empty;
53+
private string lastParameterText = string.Empty;
5354

5455
#region Overrides of ComponentBase
5556

5657
protected override async Task OnInitializedAsync()
5758
{
5859
this.text = this.Text;
60+
this.lastParameterText = this.Text;
5961
this.debounceTimer.AutoReset = false;
6062
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
6163
this.debounceTimer.Elapsed += (_, _) =>
@@ -68,6 +70,19 @@ protected override async Task OnInitializedAsync()
6870

6971
await base.OnInitializedAsync();
7072
}
73+
74+
protected override void OnParametersSet()
75+
{
76+
// Only sync when the parent's parameter actually changed since the last change:
77+
if (this.Text != this.lastParameterText)
78+
{
79+
this.text = this.Text;
80+
this.lastParameterText = this.Text;
81+
82+
this.debounceTimer.Stop();
83+
this.debounceTimer.Start();
84+
}
85+
}
7186

7287
#endregion
7388

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
# v0.9.51, build 226 (2025-08-xx xx:xx UTC)
2+
- Fixed a bug in various assistants where some text fields were not reset when resetting.

0 commit comments

Comments
 (0)