Skip to content

🐛[BUG] 更新后editable onSave里面的record始终不变 #9381

@Teeoo

Description

@Teeoo

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

📷 复现步骤

🏞 期望结果

💻 复现代码

const editable = useMemo<RowEditableConfig<T>>(
		() => ({
			actionRender: (
				_row: any,
				_config: any,
				defaultDoms: { save: any; cancel: any }
			) => [defaultDoms.save, defaultDoms.cancel],
			onSave: async (key, record, origin, newLineConfig) => {
				if (!isEqual(record, origin)) {
					const exclude = ['id', 'create_time', 'index']
					if (options?.modifyExclude?.length) {
						exclude.push(...options?.modifyExclude)
					}
					try {
						const { msg } = await request<Response>(
							options?.url?.update || '',
							{
								method: 'POST',
								params: { id: record.id },
								data: omit(record, exclude)
							}
						)
						tableRef.current?.reload()
						notification.success({
							description: msg,
							message: '操作提示'
						})
					} catch (error) {
						console.error('保存数据错误:', error) 
					}
				}
			}
		}),
		[options]
	)

© 版本信息

  • ProComponents 版本: 3.1.0-0
  • umi 版本:4.6.20
  • antd 版本:6.1.4
  • 浏览器环境 Chrome
  • 开发环境 [e.g. mac OS]

🚑 其他信息

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions