mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 05:02:17 +00:00
refactor: centralize display_name || name into getAssetDisplayName (#9641)
## Summary Centralize the inline `display_name || name` pattern into `getAssetDisplayName`, adding `display_name` to the existing metadata fallback chain. ## Changes - **What**: Update `getAssetDisplayName` fallback chain to `user_metadata.name → metadata.name → display_name → name`. Replace all 6 inline `asset.display_name || asset.name` call sites with the shared utility. Remove duplicate local function in `AssetsSidebarListView.vue`. ## Review Focus The fallback order preserves user_metadata overrides while incorporating the `display_name` field added in #9626. All callers now go through a single code path. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9641-refactor-centralize-display_name-name-into-getAssetDisplayName-31e6d73d365081e09e5de85486583443) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -90,6 +90,7 @@ import AssetsListItem from '@/platform/assets/components/AssetsListItem.vue'
|
||||
import type { OutputStackListItem } from '@/platform/assets/composables/useOutputStacks'
|
||||
import { getOutputAssetMetadata } from '@/platform/assets/schemas/assetMetadataSchema'
|
||||
import type { AssetItem } from '@/platform/assets/schemas/assetSchema'
|
||||
import { getAssetDisplayName } from '@/platform/assets/utils/assetMetadataUtils'
|
||||
import { iconForMediaType } from '@/platform/assets/utils/mediaIconUtil'
|
||||
import { useAssetsStore } from '@/stores/assetsStore'
|
||||
import {
|
||||
@@ -135,10 +136,6 @@ const listGridStyle = {
|
||||
gap: '0.5rem'
|
||||
}
|
||||
|
||||
function getAssetDisplayName(asset: AssetItem): string {
|
||||
return asset.display_name || asset.name
|
||||
}
|
||||
|
||||
function getAssetPrimaryText(asset: AssetItem): string {
|
||||
return truncateFilename(getAssetDisplayName(asset))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user