From 3fc8b4903849d75f04a05abc7985c2ac694851c0 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 18 Oct 2025 01:25:59 -0700 Subject: [PATCH] [refactor] simplify redundant check in cloud badge extension (#6106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies code with tautological condition. The extension is only loaded when `isCloud` is true due to https://github.com/Comfy-Org/ComfyUI_frontend/blob/38f188759dac8d3d8923156dd238c26594421f20/src/extensions/core/index.ts#L27-L29 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6106-refactor-simplify-redundant-check-in-cloud-badge-extension-28f6d73d365081d69903f5a985fdc8be) by [Unito](https://www.unito.io) --- src/extensions/core/cloudBadge.ts | 16 ++++++---------- src/platform/distribution/types.ts | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/extensions/core/cloudBadge.ts b/src/extensions/core/cloudBadge.ts index 5f2b569fa6..6a1074a7d8 100644 --- a/src/extensions/core/cloudBadge.ts +++ b/src/extensions/core/cloudBadge.ts @@ -1,16 +1,12 @@ import { t } from '@/i18n' -import { isCloud } from '@/platform/distribution/types' import { useExtensionService } from '@/services/extensionService' useExtensionService().registerExtension({ name: 'Comfy.CloudBadge', - // Only show badge when running in cloud environment - topbarBadges: isCloud - ? [ - { - label: t('g.beta'), - text: 'Comfy Cloud' - } - ] - : undefined + topbarBadges: [ + { + label: t('g.beta'), + text: 'Comfy Cloud' + } + ] }) diff --git a/src/platform/distribution/types.ts b/src/platform/distribution/types.ts index 2ddeb13431..d03e6d53b8 100644 --- a/src/platform/distribution/types.ts +++ b/src/platform/distribution/types.ts @@ -17,4 +17,4 @@ const DISTRIBUTION: Distribution = __DISTRIBUTION__ /** Distribution type checks */ export const isDesktop = DISTRIBUTION === 'desktop' || isElectron() // TODO: replace with build var export const isCloud = DISTRIBUTION === 'cloud' -// export const isLocalhost = !isDesktop && !isCloud +// export const isLocalhost = DISTRIBUTION === 'localhost' || (!isDesktop && !isCloud)