Commit 1fdfc24
sword
fix(web): new session button fails on fresh start with no opened projects
On a fresh `opencode web` start, the "New Session" button in the titlebar
silently does nothing and the home page hides its "New Session" buttons.
This happens because:
1. `newSessionProject()` in home.tsx relies solely on
`projects()` (persisted opened projects), which is empty.
2. `openNewTab()` in titlebar.tsx has a 5-case fallback chain that
all fail when no projects are persisted: home selection is empty,
layout.projects.list() is empty, and
global.ensureServerCtx(conn).projects.list() returns only persisted
projects — never server-registered ones.
Fix:
- home.tsx: add sync data fallback to `newSessionProject` (registered
projects from the server API)
- titlebar.tsx: add a final fallback that reads server-registered
projects from sync.data.project when all other cases fail1 parent 45cd8d7 commit 1fdfc24
2 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
371 | 374 | | |
372 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
373 | 385 | | |
374 | 386 | | |
375 | 387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| |||
0 commit comments