Skip to content

Conversation

@anntnzrb
Copy link

Summary

Changes

When using -c flag:

  1. session.list() is now loaded in the blocking phase (instead of non-blocking)
  2. The continue effect triggers at "partial" status (instead of waiting for "complete")

This ensures the session data is available immediately, so navigation to the resumed session happens before the dashboard ever renders.

Testing

  1. Start opencode, create a session with messages
  2. Exit
  3. Run opencode -c
  4. Session should appear directly without dashboard flash

When using 'opencode -c' to resume a session, the session list is now
loaded in the blocking phase instead of non-blocking. This eliminates
the confusing flash of the dashboard before the resumed session appears.

The continue effect now triggers at 'partial' status since the session
data is already available at that point.
@rekram1-node
Copy link
Collaborator

/review


await Promise.all(blockingRequests)
.then(() => {
if (store.status !== "complete") setStore("status", "partial")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Consider using spread syntax instead of mutable .push() to stay consistent with the style guide preference of avoiding mutation patterns. This is a minor stylistic improvement - the current code is functional and clear.

Suggested change
if (store.status !== "complete") setStore("status", "partial")
const blockingRequests: Promise<unknown>[] = [
sdk.client.config.providers({}, { throwOnError: true }).then((x) => {
batch(() => {
setStore("provider", x.data!.providers)
setStore("provider_default", x.data!.default)
})
}),
sdk.client.provider.list({}, { throwOnError: true }).then((x) => {
batch(() => {
setStore("provider_next", x.data!)
})
}),
sdk.client.app.agents({}, { throwOnError: true }).then((x) => setStore("agent", x.data ?? [])),
sdk.client.config.get({}, { throwOnError: true }).then((x) => setStore("config", x.data!)),
...(args.continue ? [sessionListPromise] : []),
]
await Promise.all(blockingRequests)

async function bootstrap() {
// blocking
await Promise.all([
const args = useArgs()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential Issue: Calling useArgs() inside an async function (bootstrap) might not be the safest pattern for SolidJS context hooks. Consider moving the useArgs() call to the top of the init function (alongside other hook calls like useExit()), then reference args inside bootstrap. This ensures the hook is called synchronously during component initialization.

Suggested change
const args = useArgs()
const exit = useExit()
const args = useArgs()
async function bootstrap() {
const sessionListPromise = sdk.client.session.list().then((x) =>

This is a suggestion - the current code may work fine in practice, but the safer pattern would be to call hooks at the top level of the init function.

rekram1-node and others added 3 commits December 19, 2025 14:38
- Move useArgs() to init top-level for safer SolidJS hook pattern
- Use spread syntax instead of .push() to avoid mutation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode -c shows dashboard before resuming session

2 participants