Skip to content

fix(vue): fixed modal component failed to trigger update in [email protected] #7244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion components/_util/vnode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { filterEmpty } from './props-util';
import type { VNode, VNodeProps } from 'vue';
import { cloneVNode, isVNode } from 'vue';
import { cloneVNode, isVNode, render as VueRender } from 'vue';
import warning from './warning';
import type { RefObject } from './createRef';
type NodeProps = Record<string, any> &
Expand Down Expand Up @@ -51,3 +51,7 @@ export function deepCloneElement<T, U>(
return cloned;
}
}

export function triggerVNodeUpdate(vm: VNode, attrs: Record<string, any>, dom: any) {
VueRender(cloneVNode(vm, { ...attrs }), dom);
}
4 changes: 2 additions & 2 deletions components/modal/confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ConfirmDialog from './ConfirmDialog';
import type { ModalFuncProps } from './Modal';
import ConfigProvider, { globalConfigForApi } from '../config-provider';
import omit from '../_util/omit';
import { triggerVNodeUpdate } from '../_util/vnode';

import { getConfirmLocale } from './locale';
import destroyFns from './destroyFns';
Expand Down Expand Up @@ -70,8 +71,7 @@ const confirm = (config: ModalFuncProps) => {
};
}
if (confirmDialogInstance) {
Object.assign(confirmDialogInstance.component.props, currentConfig);
confirmDialogInstance.component.update();
triggerVNodeUpdate(confirmDialogInstance, currentConfig, container);
}
}

Expand Down