fix(tauri-app): NavRail click → view switch via callback prop

The `bind:current={view}` pattern in NavRail did not propagate
clicks to the parent's $state. Svelte 5's $bindable on this
runtime is flakey and on this particular build (Tauri 2.11 +
svelte 5.x) the setter was never invoked when a button was
clicked, so the view state stayed 'home' no matter which rail
button the user pressed. The user reported 'search tut sich nix
genau auch bei compose etc.'

Replace with explicit callback prop:
  let { view = 'home', on_select } = $props();
  onclick={() => on_select?.(item.id)}
The parent then mutates its own `view` rune directly via the
arrow function — Svelte tracks this unconditionally regardless of
runtime-specific bindable semantics.

Includes a vitest regression test that mounts a real Svelte
component harness (jsdom) and asserts that click events on each
rail button flip the parent's `view` and update the .active
class — so any future regression is caught in CI rather than at
the Tauri app window.
This commit is contained in:
tomdebone
2026-07-06 22:59:29 +02:00
parent a60b612f68
commit 1c75d56134
7 changed files with 656 additions and 12 deletions
+6 -1
View File
@@ -373,7 +373,12 @@
</div>
{:else}
<div class="shell">
<NavRail bind:current={view} />
<NavRail
{view}
on_select={(v) => {
view = v;
}}
/>
<div class="main">
<Terminal title={view === "home" ? "maarcadetweet — home" : `maarcadetweet — ${view}`}>
{#if view === "home"}