mirror of
https://github.com/anomalyco/opencode.git
synced 2026-06-01 22:10:06 +02:00
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:
committed by
GitHub
parent
8f2afba7a5
commit
abaabdcb73
@@ -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()}
|
||||
|
||||
@@ -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" }),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user