mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-21 21:31:53 +08:00
tui: fix session resumption with --session-id flag to navigate after app initialization
Previously when passing a session ID directly, the route was set during initial render which could cause navigation issues before the router was fully ready. Now the session navigation happens after initialization completes, ensuring the TUI properly loads the requested session when users resume with --session-id.
This commit is contained in:
@@ -150,7 +150,7 @@ export function tui(input: {
|
||||
<ToastProvider>
|
||||
<RouteProvider
|
||||
initialRoute={
|
||||
(input.args.sessionID || input.args.continue) && !input.args.fork
|
||||
input.args.continue
|
||||
? {
|
||||
type: "session",
|
||||
sessionID: "dummy",
|
||||
@@ -342,6 +342,12 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
||||
})
|
||||
local.model.set({ providerID, modelID }, { recent: true })
|
||||
}
|
||||
if (args.sessionID && !args.fork) {
|
||||
route.navigate({
|
||||
type: "session",
|
||||
sessionID: args.sessionID,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user