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 />
|
<Home />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={route.data.type === "session"}>
|
<Match when={route.data.type === "session"}>
|
||||||
<Session />
|
<Show when={route.data.type === "session" ? route.data.sessionID : undefined} keyed>
|
||||||
|
{(_) => <Session />}
|
||||||
|
</Show>
|
||||||
</Match>
|
</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
{plugin()}
|
{plugin()}
|
||||||
|
|||||||
@@ -384,10 +384,19 @@ export const layer: Layer.Layer<
|
|||||||
|
|
||||||
function cleanDirectory(target: string) {
|
function cleanDirectory(target: string) {
|
||||||
return Effect.tryPromise({
|
return Effect.tryPromise({
|
||||||
try: () =>
|
try: async () => {
|
||||||
import("fs/promises").then((fsp) =>
|
const fsp = await import("fs/promises")
|
||||||
fsp.rm(target, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }),
|
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) =>
|
catch: (error) =>
|
||||||
new RemoveFailedError({ message: errorMessage(error) || "Failed to remove git worktree directory" }),
|
new RemoveFailedError({ message: errorMessage(error) || "Failed to remove git worktree directory" }),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user