Skip to content

fix(app): create fresh web sessions in server directory#37607

Open
ndj888 wants to merge 3 commits into
anomalyco:devfrom
ndj888:fix/web-new-session-empty-projects
Open

fix(app): create fresh web sessions in server directory#37607
ndj888 wants to merge 3 commits into
anomalyco:devfrom
ndj888:fix/web-new-session-empty-projects

Conversation

@ndj888

@ndj888 ndj888 commented Jul 18, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #37606

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When the opened-project list is empty, new sessions now fall back to the server startup directory returned by /path.

The home empty state exposes its New Session action, and the titlebar action opens and remembers that directory before creating the draft. Existing selected, recent, and opened-project behavior stays unchanged.

How did you verify your code works?

  • Cleared localStorage in an isolated Chrome context.
  • Started the app UI against a local server without adding a project.
  • Verified both the home empty-state action and titlebar action navigate to /new-session?draftId=... for the server startup directory.
  • Verified the titlebar path persists that directory as the opened and last project.
  • Ran bun test --preload ./happydom.ts ./src/pages/layout/helpers.test.ts (29 passed).
  • Ran bun run typecheck and Prettier checks.

Screenshots / recordings

The browser verification rendered the new-session composer for the server startup directory from a clean storage state.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

sword added 3 commits July 18, 2026 09:02
…ects

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 fail
@ndj888
ndj888 requested review from Brendonovich and Hona as code owners July 18, 2026 04:48
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.

Web: New Session does nothing when no project has been opened

1 participant