mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-17 09:18:26 +00:00
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:
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user