fix(model-pricing): 修复可视化模型定价列表项无法删除 (#5628)

删除时已从草稿中移除模型,但列表为 saved∪draft 并集且优先取 saved,
导致行不消失(isDraftDeleted 计算后未被使用),表现为无法删除。改为过滤
掉已暂存删除的行;并在删除当前正在编辑的行时关闭编辑器,避免从残留面板
保存又把模型写回。
This commit is contained in:
skynono
2026-06-20 22:08:29 +08:00
committed by GitHub
parent 0c6c1b373a
commit d58029c637
@@ -225,6 +225,7 @@ const ModelRatioVisualEditorComponent = forwardRef<
isDraftNew: Boolean(!saved && draft),
}
})
.filter((row) => !row.isDraftDeleted)
.sort((a, b) => a.name.localeCompare(b.name))
}, [
savedModelPrice,
@@ -392,6 +393,12 @@ const ModelRatioVisualEditorComponent = forwardRef<
'billing_setting.billing_expr',
JSON.stringify(billingExprMap, null, 2)
)
if (editData?.name === name) {
setEditData(null)
setEditorOpen(false)
setSheetOpen(false)
}
},
[
modelPrice,
@@ -405,6 +412,7 @@ const ModelRatioVisualEditorComponent = forwardRef<
billingMode,
billingExpr,
onChange,
editData,
]
)