mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
fix(settings): surface "installed but not runnable" state in tool cards
After an install/update command succeeds, re-probe the tool version: if it still can't be detected the tool is installed-but-unrunnable (e.g. Node too old), so report a warning toast and show "installed · can't run" with the cause, instead of a misleading "success" plus a stale version number. Read the backend `installed_but_broken` flag rather than matching error text; the card's current-version line, action button (no useless "install" for a broken tool), and a "check environment" hint all key off it. Drop the now-redundant version-clearing setState (the refresh merge already nulls it), flatten the action ternary, and use extractErrorMessage in the catch path. Adds toolNotRunnable / toolActionInstalledNotRunnable / installedNotRunnable / toolCheckEnv i18n keys (zh/en/ja).
This commit is contained in:
@@ -185,6 +185,7 @@ export const settingsApi = {
|
||||
version: string | null;
|
||||
latest_version: string | null;
|
||||
error: string | null;
|
||||
installed_but_broken: boolean;
|
||||
env_type: "windows" | "wsl" | "macos" | "linux" | "unknown";
|
||||
wsl_distro: string | null;
|
||||
}>
|
||||
|
||||
Reference in New Issue
Block a user