mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 17:52:16 +00:00
[backport cloud/1.37] feat: implement progressive pagination for Asset Browser model assets (#8240)
Backport of #8212 to cloud/1.37 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8240-backport-cloud-1-37-feat-implement-progressive-pagination-for-Asset-Browser-model-asse-2f06d73d365081b199a0dd6bcc242bba) by [Unito](https://www.unito.io) Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -112,27 +112,21 @@ const cacheKey = computed(() => {
|
||||
})
|
||||
|
||||
// Read directly from store cache - reactive to any store updates
|
||||
const fetchedAssets = computed(
|
||||
() => assetStore.modelAssetsByNodeType.get(cacheKey.value) ?? []
|
||||
)
|
||||
const fetchedAssets = computed(() => assetStore.getAssets(cacheKey.value))
|
||||
|
||||
const isStoreLoading = computed(
|
||||
() => assetStore.modelLoadingByNodeType.get(cacheKey.value) ?? false
|
||||
)
|
||||
const isStoreLoading = computed(() => assetStore.isModelLoading(cacheKey.value))
|
||||
|
||||
// Only show loading spinner when loading AND no cached data
|
||||
const isLoading = computed(
|
||||
() => isStoreLoading.value && fetchedAssets.value.length === 0
|
||||
)
|
||||
|
||||
async function refreshAssets(): Promise<AssetItem[]> {
|
||||
async function refreshAssets(): Promise<void> {
|
||||
if (props.nodeType) {
|
||||
return await assetStore.updateModelsForNodeType(props.nodeType)
|
||||
await assetStore.updateModelsForNodeType(props.nodeType)
|
||||
} else if (props.assetType) {
|
||||
await assetStore.updateModelsForTag(props.assetType)
|
||||
}
|
||||
if (props.assetType) {
|
||||
return await assetStore.updateModelsForTag(props.assetType)
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
// Trigger background refresh on mount
|
||||
|
||||
Reference in New Issue
Block a user