agent: fix — infinite reactivity loop in TaskSidebar froze entire app

prevTaskIds was declared as $state, causing the $effect that writes to
it to re-trigger itself infinitely (effect_update_depth_exceeded). The
variable is just a comparison reference — doesn't need to be reactive.
Changed to a plain let.

Also removed debug event loggers and reverted grain z-index.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 18:56:54 +01:00
parent 1a8f3c7582
commit fdc4a3cba5
2 changed files with 9 additions and 8 deletions

View File

@@ -20,7 +20,9 @@
}
// Track recently added tasks for highlight animation
let prevTaskIds = $state(new Set(tasks.map((t) => t.id)));
// Use a plain variable (not $state) for previous IDs to avoid
// read-write loop inside the $effect.
let prevTaskIds = new Set(tasks.map((t) => t.id));
$effect(() => {
const currentIds = new Set(tasks.map((t) => t.id));
for (const id of currentIds) {

View File

@@ -14,6 +14,7 @@
const prefs = getPreferences();
// Detect secondary windows (float, viewer) — they use +layout@.svelte
// but as a fallback, hide chrome if the URL matches
let isSecondaryWindow = $derived(
@@ -211,13 +212,11 @@
<div class="flex-1 overflow-hidden bg-bg">
{@render children()}
</div>
{#if page.taskSidebarOpen && page.current !== "first-run"}
<div class="w-[280px] min-w-[280px] shadow-xl">
<TaskSidebar />
</div>
{/if}
</div>
</div>
<!-- Task sidebar — floats over content, no blocking overlay -->
{#if page.taskSidebarOpen && page.current !== "first-run" && !isSecondaryWindow}
<div class="fixed top-[36px] right-0 bottom-0 w-[280px] z-50 shadow-xl">
<TaskSidebar />
</div>
{/if}
{/if}