Standardize sidebar lifecycle on folder switch (key remount vs prop effects) #1

Open
opened 2026-09-02 02:35:44 -04:00 by toph · 0 comments
Owner

Location

src/lib/features/app-shell/WorkbenchView.svelte:66, FilesSidebar.svelte, GitGraph.svelte, GitStashList.svelte, GitBranches.svelte

Problem

WorkbenchView.svelte wraps sidebar components in {#key folderPath}, causing a full teardown and remount whenever switching between tabs with different folders. Meanwhile, FilesSidebar, GitGraph, GitStashList, and GitBranches still retain internal $effect blocks designed to reset state on folderPath prop changes.

Suggested Fix

Pick one consistent lifecycle approach:

  • Either rely on key-based remounting and remove the redundant manual reset effects in the sidebar components,
  • Or remove {#key folderPath} in WorkbenchView and let prop-driven reactivity handle folder transitions cleanly.
### Location `src/lib/features/app-shell/WorkbenchView.svelte:66`, `FilesSidebar.svelte`, `GitGraph.svelte`, `GitStashList.svelte`, `GitBranches.svelte` ### Problem `WorkbenchView.svelte` wraps sidebar components in `{#key folderPath}`, causing a full teardown and remount whenever switching between tabs with different folders. Meanwhile, `FilesSidebar`, `GitGraph`, `GitStashList`, and `GitBranches` still retain internal `$effect` blocks designed to reset state on `folderPath` prop changes. ### Suggested Fix Pick one consistent lifecycle approach: - Either rely on key-based remounting and remove the redundant manual reset effects in the sidebar components, - Or remove `{#key folderPath}` in `WorkbenchView` and let prop-driven reactivity handle folder transitions cleanly.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/Sworm#1
No description provided.