fix(tui): remount session view on session switch (#30129)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-05-31 18:30:29 +00:00
committed by GitHub
parent 8f2afba7a5
commit abaabdcb73
2 changed files with 16 additions and 5 deletions
+3 -1
View File
@@ -1082,7 +1082,9 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
<Home />
</Match>
<Match when={route.data.type === "session"}>
<Session />
<Show when={route.data.type === "session" ? route.data.sessionID : undefined} keyed>
{(_) => <Session />}
</Show>
</Match>
</Switch>
{plugin()}
+13 -4
View File
@@ -384,10 +384,19 @@ export const layer: Layer.Layer<
function cleanDirectory(target: string) {
return Effect.tryPromise({
try: () =>
import("fs/promises").then((fsp) =>
fsp.rm(target, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }),
),
try: async () => {
const fsp = await import("fs/promises")
const attempts = process.platform === "win32" ? 50 : 5
for (const attempt of Array.from({ length: attempts }, (_, i) => i)) {
try {
await fsp.rm(target, { recursive: true, force: true })
return
} catch (error) {
if (attempt === attempts - 1) throw error
await new Promise((resolve) => setTimeout(resolve, 100))
}
}
},
catch: (error) =>
new RemoveFailedError({ message: errorMessage(error) || "Failed to remove git worktree directory" }),
})