完善拼单状态与份额验收流程
This commit is contained in:
@@ -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