Skip to content

Commit

Permalink
chore: better code style
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed May 25, 2023
1 parent 79c6c93 commit a620938
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/utils/src/useEditableArray/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ const CancelEditableAction: React.FC<ActionRenderConfig<any> & { row: any }> = (
form.getFieldValue(namePath);
const record = isMapEditor ? set({}, namePath, fields) : fields;
const res = await onCancel?.(recordKey, record, row, newLineConfig);
cancelEditable(recordKey);
await cancelEditable(recordKey);
/** 重置为默认值,不然编辑的行会丢掉 */
form.setFieldsValue({
[recordKey as React.Key]: isMapEditor ? get(row, namePath) : row,
Expand Down Expand Up @@ -918,7 +918,7 @@ export function useEditableArray<RecordType>(
newLine?: NewLineConfig<RecordType>,
) => {
// 保存时解除编辑模式,这个要提前一下不然数据会被清空
cancelEditable(recordKey);
await cancelEditable(recordKey);

const res = await props?.onSave?.(recordKey, editRow, originRow, newLine);
const { options } = newLine || newLineRecordRef.current || {};
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/useEditableMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function useEditableMap<RecordType>(
if (success === false) {
return false;
}
cancelEditable(recordKey);
await cancelEditable(recordKey);
const actionProps = {
data: props.dataSource,
row: editRow,
Expand Down

0 comments on commit a620938

Please sign in to comment.