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.
This commit is contained in:
Glary Bot
2026-06-26 00:02:47 +00:00
parent 19f5c9f6ae
commit a98d5557db
3 changed files with 7 additions and 7 deletions

View File

@@ -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",

View File

@@ -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()
})
})

View File

@@ -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))
}