From a98d5557db888e7dfd4f93887dbb0653bf1efb63 Mon Sep 17 00:00:00 2001 From: Glary Bot Date: Fri, 26 Jun 2026 00:02:47 +0000 Subject: [PATCH] fix(assets): disable Use for no-category assets; drop duplicate i18n key - canCreateNodeForAsset now returns false when the asset has no usable category tag, matching resolveModelNodeFromAsset's INVALID_ASSET rejection. Previously this branch returned true and let users click through to the same error toast this PR is meant to suppress. - Drop the duplicate `whatsIncluded` key at en/main.json:2587 (kept the identical 2677 occurrence); Biome's noDuplicateObjectKeys would fail lint on this. Introduced by the rebased billing-panel commit, fixed here as a one-line drive-by to keep the PR's lint pass clean. --- src/locales/en/main.json | 1 - .../assets/utils/resolveModelNodeFromAsset.test.ts | 4 ++-- src/platform/assets/utils/resolveModelNodeFromAsset.ts | 9 +++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 5f1fd0277f..4cd015e772 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2584,7 +2584,6 @@ "viewMoreDetailsPlans": "View more details about plans & pricing", "nextBillingCycle": "next billing cycle", "yourPlanIncludes": "Your plan includes:", - "whatsIncluded": "What's included:", "planLoadError": "We couldn't load your plan details.", "planLoadErrorRetry": "Try again", "teamPlanName": "Team", diff --git a/src/platform/assets/utils/resolveModelNodeFromAsset.test.ts b/src/platform/assets/utils/resolveModelNodeFromAsset.test.ts index 1f29ef1376..6cad5b17f0 100644 --- a/src/platform/assets/utils/resolveModelNodeFromAsset.test.ts +++ b/src/platform/assets/utils/resolveModelNodeFromAsset.test.ts @@ -277,10 +277,10 @@ describe('canCreateNodeForAsset', () => { expect(mockGetNodeProvider).toHaveBeenCalledWith('BEN') }) - it('returns true when the asset has no usable category tag', () => { + it('returns false when the asset has no usable category tag (would fail INVALID_ASSET)', () => { expect( canCreateNodeForAsset(createMockAsset({ tags: ['models', 'missing'] })) - ).toBe(true) + ).toBe(false) expect(mockGetNodeProvider).not.toHaveBeenCalled() }) }) diff --git a/src/platform/assets/utils/resolveModelNodeFromAsset.ts b/src/platform/assets/utils/resolveModelNodeFromAsset.ts index fa61a525d1..79bb042521 100644 --- a/src/platform/assets/utils/resolveModelNodeFromAsset.ts +++ b/src/platform/assets/utils/resolveModelNodeFromAsset.ts @@ -18,9 +18,10 @@ export function getAssetCategory(asset: AssetItem): string | undefined { /** * Returns `false` only when we are confident the asset cannot be turned into a - * node (registry is initialised and no provider matches its category). While - * the registry is still warming up we return `true` so the UI stays enabled - * by default and only transitions to disabled once we know. + * node — either its category has no provider in the (initialised) registry, or + * it carries no usable category tag at all. While the registry is still warming + * up we return `true` so the UI stays enabled by default and only transitions + * to disabled once we know. */ export function canCreateNodeForAsset(asset: AssetItem): boolean { const store = useModelToNodeStore() @@ -28,7 +29,7 @@ export function canCreateNodeForAsset(asset: AssetItem): boolean { if (!store.isReady) return true const category = getAssetCategory(asset) - if (!category) return true + if (!category) return false return Boolean(store.getNodeProvider(category)) }