Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb5a629

Browse files
committed
fix: clone modal context.config and globalProperties to not mutate root context
1 parentf2045ab commitbb5a629

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/plugins/modals.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,17 @@ export async function $showModal<T = any, P = any>(
130130
view.nativeView?.closeModal(...args);
131131
};
132132

133-
view.context.config.globalProperties.$closeModal=closeModal;
134-
view.context.config.globalProperties.$modal={close:closeModal};
133+
// clone the config and globalProperties to avoid mutating the root app's config/globalProperties
134+
constcontext=view.context;
135+
context.config=Object.assign({},context.config);
136+
context.config.globalProperties=Object.assign(
137+
{},
138+
context.config.globalProperties,
139+
{
140+
$closeModal:closeModal,
141+
$modal:{close:closeModal},
142+
},
143+
);
135144

136145
view.mount(root);
137146
openModal();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp