Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 8330479

Browse files
Fix typing too fast in the preset search causing rubber banding with old search values
1 parent 5b69bdb commit 8330479

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

Alidade/Components/Panels/InspectorPanel.razor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ OsmElementTypes.Relation when buf.Relations.TryGetValue(_targetRef.Id, out OsmRe
285285
_query = string.Empty;
286286
_isSearching = false;
287287
_results = [];
288+
_nsiResults = [];
288289
}
289290

290291
private void PinCurrent()

Alidade/Components/Panels/PresetPanel.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
<div class="preset-panel">
44
<div class="preset-search-row">
5-
<input @ref="_searchInput"
5+
<input @key="_inputKey"
6+
@ref="_searchInput"
67
type="text"
78
placeholder="Search presets…"
8-
value="@_query"
99
@oninput="OnQueryChanged"
1010
class="preset-search-input" />
1111
</div>

Alidade/Components/Panels/PresetPanel.razor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public partial class PresetPanel(
1414
ToolStateService ToolState) : IDisposable
1515
{
1616
private string _query = string.Empty;
17+
private int _inputKey = 0;
1718
private List<Preset> _results = [];
1819
private Preset? _activePreset;
1920
private ElementReference _searchInput;
@@ -41,6 +42,7 @@ private void OnSelectionChanged(object? sender, EventArgs e)
4142
{
4243
_results = [];
4344
_query = string.Empty;
45+
_inputKey++;
4446
_activePreset = ResolveActivePreset();
4547
StateHasChanged();
4648
}
@@ -118,6 +120,7 @@ OsmElementTypes.Relation when buf.Relations.TryGetValue(selected.Id, out OsmRela
118120
_activePreset = preset;
119121
_query = string.Empty;
120122
_results = [];
123+
_inputKey++;
121124
}
122125

123126
/// <inheritdoc />

0 commit comments

Comments
 (0)