From d2f418f4942dacc83b05369dce703c9c5c34f5ac Mon Sep 17 00:00:00 2001 From: gnezim Date: Mon, 20 Apr 2026 11:55:48 +0300 Subject: [PATCH] =?UTF-8?q?Show=20CityAutocomplete=20clear=20(=C3=97)=20bu?= =?UTF-8?q?tton=20for=20any=20truthy=20value,=20not=20just=20resolved=20ci?= =?UTF-8?q?ties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously hasValue was computed from `selectedCity` — which required the dictionaries to be loaded AND the raw code to map to a known city. If the dictionaries were slow or the user typed free text, the clear button stayed hidden and the filter became stuck with no way to wipe it. Angular's CityAutocomplete uses `[ngClass]="{'has-value': city}"` on the raw two-way-bound model, so any truthy value reveals the clear button. Mirror that: `hasValue` is now true whenever the resolved city, the outbound code, or the AutoComplete inputValue (free text or suggestion object) is truthy. --- src/ui/city-autocomplete/CityAutocomplete.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ui/city-autocomplete/CityAutocomplete.tsx b/src/ui/city-autocomplete/CityAutocomplete.tsx index 1e79066f..d47070a4 100644 --- a/src/ui/city-autocomplete/CityAutocomplete.tsx +++ b/src/ui/city-autocomplete/CityAutocomplete.tsx @@ -124,7 +124,16 @@ export const CityAutocomplete: FC = ({ } return null; })(); - const hasValue = Boolean(selectedCity); + // Mirror Angular's `[ngClass]="{ 'has-value': city }"` — any truthy + // model value (resolved city OR a free-typed string OR the raw code + // before dictionaries load) should reveal the clear button. Otherwise + // users can't wipe a partial input when the dictionary hasn't caught + // up yet. + const hasValue = Boolean( + selectedCity || + value || + (typeof inputValue === "string" ? inputValue : inputValue?.name), + ); return (