fix(ui): prevent hero flicker when clearing sender input
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:
@@ -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>
|
||||
|
||||
@@ -76,7 +76,7 @@ function handleSuggestionSelect(id: string) {
|
||||
bind:value={senderId}
|
||||
initialName={initialSenderName}
|
||||
restrictToCorrespondentsOf={receiverId || undefined}
|
||||
onchange={() => onapplyFilters()}
|
||||
onchange={(id) => { if (id) onapplyFilters(); }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user