Skip to content

Commit 4ed2868

Browse files
authored
fix(vue): fixed modal component failed to trigger update in [email protected] (#7244)
* fix(vue): fixed modal component failed to trigger update in [email protected] version * refactor: use cloneVNode trigger vNode update
1 parent 8696e01 commit 4ed2868

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

components/_util/vnode.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { filterEmpty } from './props-util';
22
import type { VNode, VNodeProps } from 'vue';
3-
import { cloneVNode, isVNode } from 'vue';
3+
import { cloneVNode, isVNode, render as VueRender } from 'vue';
44
import warning from './warning';
55
import type { RefObject } from './createRef';
66
type NodeProps = Record<string, any> &
@@ -51,3 +51,7 @@ export function deepCloneElement<T, U>(
5151
return cloned;
5252
}
5353
}
54+
55+
export function triggerVNodeUpdate(vm: VNode, attrs: Record<string, any>, dom: any) {
56+
VueRender(cloneVNode(vm, { ...attrs }), dom);
57+
}

components/modal/confirm.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ConfirmDialog from './ConfirmDialog';
33
import type { ModalFuncProps } from './Modal';
44
import ConfigProvider, { globalConfigForApi } from '../config-provider';
55
import omit from '../_util/omit';
6+
import { triggerVNodeUpdate } from '../_util/vnode';
67

78
import { getConfirmLocale } from './locale';
89
import destroyFns from './destroyFns';
@@ -70,8 +71,7 @@ const confirm = (config: ModalFuncProps) => {
7071
};
7172
}
7273
if (confirmDialogInstance) {
73-
Object.assign(confirmDialogInstance.component.props, currentConfig);
74-
confirmDialogInstance.component.update();
74+
triggerVNodeUpdate(confirmDialogInstance, currentConfig, container);
7575
}
7676
}
7777

0 commit comments

Comments
 (0)