fix(ui): prevent hero flicker when clearing sender input
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2s
CI / Backend Unit Tests (pull_request) Failing after 2s
CI / Unit & Component Tests (push) Failing after 5s
CI / Backend Unit Tests (push) Failing after 5s

Only navigate (applyFilters) when a person is actually selected, not
when the sender input is cleared. Combined with showHero checking
data.filters.senderId, the user stays in the search bar view after
clearing — no jump back to the hero.

Refs: #179

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-06 22:56:44 +02:00
parent a3edf9d7b4
commit 7fed057e59
2 changed files with 5 additions and 3 deletions

View File

@@ -28,6 +28,8 @@ $effect(() => {
});
const isSinglePerson = $derived(!!senderId && !receiverId);
const showHero = $derived(!senderId && !data.filters.senderId);
let showAdvanced = $state(false);
const RECENT_STORAGE_KEY = 'korrespondenz_recent_persons';
@@ -94,8 +96,8 @@ function selectPerson(id: string) {
}
</script>
{#if !senderId}
<!-- Hero state: centred discovery view -->
{#if showHero}
<!-- Hero state: only on fresh page load with no context -->
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<CorrespondenzHero onSelectPerson={selectPerson} recentPersons={recentPersons} />
</div>

View File

@@ -76,7 +76,7 @@ function handleSuggestionSelect(id: string) {
bind:value={senderId}
initialName={initialSenderName}
restrictToCorrespondentsOf={receiverId || undefined}
onchange={() => onapplyFilters()}
onchange={(id) => { if (id) onapplyFilters(); }}
/>
</div>