Skip to content

Phase 3.1 + directory picker fix#71

Merged
baochipham942-eng merged 7 commits intomainfrom
phase3-multi-preview
Apr 23, 2026
Merged

Phase 3.1 + directory picker fix#71
baochipham942-eng merged 7 commits intomainfrom
phase3-multi-preview

Conversation

@baochipham942-eng
Copy link
Copy Markdown
Owner

Summary

  • Phase 3.1: File Explorer tab auto-syncs with session workingDirectory. New openOrFocusTab store action dedups by path; covered by 4 unit tests.
  • Bug 1 fix: "选择目录" button was silently dead because Tauri's dialog was a no-op stub. Full fix includes installing tauri-plugin-dialog, routing renderer callsites through @tauri-apps/plugin-dialog, and whitelisting the http://localhost:8180 webview origin in capability ACL.
  • 3 renderer callsites now share the Tauri-native picker: TitleBar workspace chip, TaskPanel WorkingFolder, Lab RealModePanel.

Why the ACL step was load-bearing

The app loads its webview from http://localhost:8180 (Node-served renderer). Tauri treats that as a remote origin, and capabilities default to local-only. Plugin call failed with "Command plugin:dialog|open not allowed by ACL" until `remote.urls` was added to `src-tauri/capabilities/default.json`.

Test plan

  • `npm run typecheck` clean
  • 4/4 unit tests on `openOrFocusTab`
  • Release build succeeds
  • Manual: click workspace chip → Finder dialog appears; selecting a directory auto-opens that tab in File Explorer
  • Verify on a second session switch that the existing tab is reactivated rather than duplicated

Out of scope (noted for follow-up)

  • Bug 2: Skills/Task panel layout collision when both visible (deferred, will reference Codex app interaction patterns)
  • Latent: `shell:open-path` IPC channel has no handler either (WorkingFolder "open in Finder") — same pattern as Bug 1, will be fixed with plugin-opener in the next pass

🤖 Generated with Claude Code

林晨 and others added 7 commits April 22, 2026 15:36
Dedup-by-path tab open: if a tab with the same rootPath already exists,
activate it instead of creating a duplicate. Enables syncing the File
Explorer with session workingDirectory changes without churning tabs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the one-shot initRef mount effect with a continuous subscription
to appStore.workingDirectory. Whenever the active session's working
directory changes, open a tab for it or activate an existing one with
the same path. Other manually opened tabs are preserved.

Switch TabBar's Plus button and the empty-state "打开项目目录" fallback
to openOrFocusTab too, so manual opens also dedup by path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The legacy channel 'workspace:select-directory' is declared in
IPC_CHANNELS but has no registered handler in main — only the domain
dispatcher workspace.ipc.ts 'case selectDirectory' is wired. Three
callsites were still invoking the dead legacy channel and the errors
were swallowed by try/catch, so users saw "clicking does nothing":

- TitleBar workspace chip
- TaskPanel WorkingFolder picker
- Lab RealModePanel project directory picker

All three now go through ipcService.invokeDomain(IPC_DOMAINS.WORKSPACE,
'selectDirectory'), matching FileExplorerPanel's TabBar path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Registers tauri-plugin-dialog in the Rust builder, grants dialog:allow-open
capability, and installs @tauri-apps/plugin-dialog on the JS side. The
previous Electron→Tauri port left dialog.showOpenDialog as a no-op stub
in miscCompat.ts, so every "select directory" surface was silently
cancelled. The plugin provides the native directory picker the renderer
will invoke directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The main-process handleSelectDirectory calls dialog.showOpenDialog, but
under Tauri that symbol resolves to the miscCompat stub that always
returns canceled. Short-circuit in the renderer instead: when running in
a Tauri webview, lazy-import @tauri-apps/plugin-dialog and invoke its
native directory picker directly, then plumb the path into the existing
stores. Web mode keeps the window.prompt fallback.

Fixes the three dead callsites: TitleBar workspace chip, TaskPanel
WorkingFolder picker, Lab RealModePanel project directory picker.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The webview loads from http://localhost:8180, which Tauri treats as a
remote URL. Capabilities default to local-only, so dialog:allow-open
was denied at runtime even though the plugin was registered and the
JS call site was correct ("Command plugin:dialog|open not allowed by
ACL"). Adding http://localhost:8180/* to the capability's remote.urls
whitelist lets the dialog plugin accept invokes from the webview.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-agent Ready Ready Preview, Comment Apr 22, 2026 1:51pm

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.

1 participant