fix(provider): show terminal launch feedback immediately#3758
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de9b538cd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| toast.info( | ||
| t("provider.terminalOpening", { | ||
| defaultValue: "正在打开终端...", | ||
| }), | ||
| ); |
There was a problem hiding this comment.
Dismiss opening toast before reporting failures
When providersApi.openTerminal rejects after a directory is selected (for example, no supported terminal is installed or the provider lookup fails), this new info toast remains visible while the catch block also shows terminalOpenFailed. That changes the failure path from a single error message to conflicting “Opening terminal...” plus failure feedback, which is especially confusing because this commit intended to keep failures unchanged. Store the toast id and dismiss/update it before showing the error.
Useful? React with 👍 / 👎.
Opening provider terminals can block until the spawned CLI exits, so waiting for the backend command before showing feedback makes the UI look unresponsive. Show an immediate localized opening toast after directory selection, then replace it with the existing success toast once the backend returns.
The opening toast id is now tracked so failure handling can dismiss it before showing terminalOpenFailed. That keeps the failure path to one clear error message instead of leaving an 'Opening terminal...' toast beside the error.
Constraint: Keep this PR limited to frontend feedback and i18n.
Rejected: Only show terminalOpened after openTerminal resolves | on some terminal launch paths that message appears only after the terminal closes.
Confidence: high
Scope-risk: narrow
Tested: node .\\node_modules\\typescript\\bin\\tsc --noEmit
Tested: node .\\node_modules\\prettier\\bin\\prettier.cjs --check src/**/*.{js,jsx,ts,tsx,css,json}
Tested: git diff --check
Not-tested: Manual terminal launch across OS terminal apps
Co-authored-by: OmX <omx@oh-my-codex.dev>
de9b538 to
828b079
Compare
Summary
Show feedback as soon as the user picks a directory and cc-switch starts opening a provider terminal.
The first version left an
Opening terminal...toast visible whenopenTerminalfailed, so users could see both "Opening terminal..." and "Failed to open terminal" at the same time. This update tracks the toast id: success reuses that toast forTerminal opened, and failure dismisses it before showing the error.This keeps the useful immediate feedback without changing the failure path into mixed messages.
Related Issue
No linked issue.
Screenshots
Not captured; this is toast behavior only.
Checklist
terminalOpenedterminalOpenFailedVerification
node .\node_modules\typescript\bin\tsc --noEmitnode .\node_modules\prettier\bin\prettier.cjs --check "src/**/*.{js,jsx,ts,tsx,css,json}"git diff --check