fix: implement resource reconciliation and update handling in media supply favorites
This commit is contained in:
@@ -15,7 +15,7 @@ import { mediaSupplyApi } from '@/lib/api'
|
||||
import { formatDateTime } from '@/lib/display'
|
||||
import {
|
||||
loadMediaSupplyFavoriteGroups,
|
||||
mergeMediaSupplyFavoriteResourceSnapshots,
|
||||
reconcileMediaSupplyFavoriteResources,
|
||||
removeMediaSupplyFavorite,
|
||||
saveMediaSupplyFavoriteGroups,
|
||||
type MediaSupplyFavoriteGroup,
|
||||
@@ -81,11 +81,16 @@ watch(
|
||||
watch(
|
||||
() => resourceDetailsQuery.data.value?.items,
|
||||
(items) => {
|
||||
if (!items?.length) {
|
||||
if (!items || allResourceIds.value.length === 0) {
|
||||
return
|
||||
}
|
||||
groups.value = mergeMediaSupplyFavoriteResourceSnapshots(groups.value, items)
|
||||
const before = allResourceIds.value.length
|
||||
groups.value = reconcileMediaSupplyFavoriteResources(groups.value, items)
|
||||
persist()
|
||||
const removed = before - allResourceIds.value.length
|
||||
if (removed > 0) {
|
||||
message.info(`已移除 ${removed} 个已下架常发媒体`)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user