Skip to content

fix(app): open project when navigating directly to a project URL#16838

Open
minhhieugma wants to merge 1 commit intoanomalyco:devfrom
minhhieugma:fix/open-project-on-direct-url-navigation
Open

fix(app): open project when navigating directly to a project URL#16838
minhhieugma wants to merge 1 commit intoanomalyco:devfrom
minhhieugma:fix/open-project-on-direct-url-navigation

Conversation

@minhhieugma
Copy link

Issue for this PR

Closes #16837

Type of change

  • Bug fix

What does this PR do?

When the app is opened at a project URL directly (e.g. reloading the page, opening a session link in a new tab, or deep-linking), the sidebar panel renders blank. The existing auto-select createEffect bails out early when state.autoselect is false — which is always the case when a dir param is already in the URL. This means layout.projects.open() is never called, layout.projects.list() stays empty, currentProject() returns undefined, and the sidebar shows nothing.

The fix adds a second createEffect that reacts to changes in pageReady, layoutReady, currentDir(), and layout.projects.list(). If the current directory is not already in the open projects list (checking both worktree and sandboxes), it calls openProject(dir, false) to register it without navigating.

How did you verify your code works?

  1. Run opencode web and navigate to a project to get a project URL (e.g. http://localhost:4096/<base64-dir>/session).
  2. Open that URL directly in a new tab — sidebar now correctly shows project name, branch, session list and New Session button.
  3. Reload the page — sidebar remains populated.
  4. Verify the original auto-select flow (opening the app at /) still works correctly.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

@minhhieugma minhhieugma force-pushed the fix/open-project-on-direct-url-navigation branch from 3ffdab3 to b623105 Compare March 10, 2026 14:41
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.

bug(app): blank sidebar panel when navigating directly to a project URL

1 participant