fix: implement resource reconciliation and update handling in media supply favorites
Frontend CI / Frontend (push) Successful in 2m55s
Backend CI / Backend (push) Failing after 8m41s

This commit is contained in:
2026-06-23 23:34:45 +08:00
parent 04bd3e42e0
commit a406971187
6 changed files with 167 additions and 14 deletions
@@ -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} 个已下架常发媒体`)
}
},
)