完善拼单状态与份额验收流程
This commit is contained in:
@@ -424,6 +424,8 @@ function patchAdminWorkOrderCaches(
|
||||
patchWorkOrderListEnvelope(current, { ...event, operation }, shouldInsert),
|
||||
)
|
||||
}
|
||||
// 状态聚合会影响分页统计,实时行快照不能单独修正全量统计,因此同步刷新查询。
|
||||
void queryClient.invalidateQueries({ queryKey: ['admin-worker-platform-orders'] })
|
||||
}
|
||||
|
||||
function patchAdminTaskCaches(queryClient: ReturnType<typeof useQueryClient>, tasks: unknown[]) {
|
||||
|
||||
@@ -333,7 +333,12 @@ function upsertById(items: unknown[], nextItem: unknown, idKey: string, insert =
|
||||
(item) => Number((item as Record<string, unknown>)?.[idKey] || 0) === id,
|
||||
)
|
||||
if (index < 0) return insert ? [nextItem, ...items] : items
|
||||
return items.map((item, itemIndex) => (itemIndex === index ? nextItem : item))
|
||||
return items.map((item, itemIndex) => {
|
||||
if (itemIndex !== index) return item
|
||||
if (!isRecord(item) || !isRecord(nextItem)) return nextItem
|
||||
// 大厅广播是公共快照,合并后保留当前打手私有的 myShare 等字段。
|
||||
return { ...item, ...nextItem }
|
||||
})
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
|
||||
Reference in New Issue
Block a user