From 2fd628b960804bed2ed4d2d053e818802eff0389 Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Fri, 5 Jun 2026 09:26:31 +0800 Subject: [PATCH] fix(marketplace): detail CTA reflects installed state on tenant runtimes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The package-detail primary CTA stayed 'Install to cloud…' even for an already-installed package in an env console. The installed-state probe was gated on getRuntimeConfig().defaultEnvironmentId, which is empty on a per-subdomain tenant runtime — so the probe never ran. But getCloudInstallationInfo's same-origin /cloud-connection/installation path resolves the env by hostname and needs no explicit id (pairs with cloud #88). Drop the guard so the probe always runs; the CTA flips to 'Installed'. Also add the missing marketplace.action.installed i18n key (en 'Installed', zh '已安装') — code previously relied on a defaultValue fallback, so zh showed English. --- .../marketplace/MarketplacePackagePage.tsx | 16 ++++++++++------ packages/i18n/src/locales/en.ts | 1 + packages/i18n/src/locales/zh.ts | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx b/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx index 63eafd116..fa292bdf2 100644 --- a/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx +++ b/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx @@ -112,14 +112,18 @@ export function MarketplacePackagePage() { return () => { cancelled = true; }; }, [packageId, localResult]); - // Seed cloud-install state: when the runtime advertises a default - // environment (per-subdomain ObjectOS), check whether this package is - // already installed in that env so the primary CTA renders as - // "Installed" on first paint instead of inviting another install. + // Seed cloud-install state so the primary CTA renders as "Installed" on + // first paint instead of inviting another install. + // NOTE: a tenant runtime (per-subdomain ObjectOS) has NO + // `defaultEnvironmentId` — but getCloudInstallationInfo's same-origin + // `/cloud-connection/installation` path resolves the env by hostname and + // does not need an explicit id (only the cloud-control-plane path needs + // one, and it no-ops on an empty id internally). So do NOT gate the probe + // on `currentEnvId` — that left the detail CTA stuck on "Install to + // cloud…" for every already-installed package in an env console. useEffect(() => { if (!packageId) return; - const currentEnvId = getRuntimeConfig().defaultEnvironmentId; - if (!currentEnvId) return; + const currentEnvId = getRuntimeConfig().defaultEnvironmentId ?? ''; let cancelled = false; (async () => { const info = await getCloudInstallationInfo(packageId, currentEnvId); diff --git a/packages/i18n/src/locales/en.ts b/packages/i18n/src/locales/en.ts index 19841a036..eaeeb0d45 100644 --- a/packages/i18n/src/locales/en.ts +++ b/packages/i18n/src/locales/en.ts @@ -1705,6 +1705,7 @@ const en = { reinstall: 'Reinstall', working: 'Working…', installToCloud: 'Install to cloud…', + installed: 'Installed', installing: 'Installing…', uninstall: 'Uninstall', uninstalling: 'Uninstalling…', diff --git a/packages/i18n/src/locales/zh.ts b/packages/i18n/src/locales/zh.ts index f1e324c8b..16e17d436 100644 --- a/packages/i18n/src/locales/zh.ts +++ b/packages/i18n/src/locales/zh.ts @@ -1699,6 +1699,7 @@ const zh = { reinstall: '重新安装', working: '处理中…', installToCloud: '安装到云端…', + installed: '已安装', installing: '安装中…', uninstall: '卸载', uninstalling: '卸载中…',