From 570fa85809c39a8d32e2696087f3a08d8546e863 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Wed, 27 Oct 2021 00:07:59 +0300 Subject: [PATCH] Fix regression after PR #3046 `dialogHelper.open` has become async and it is not possible to perform any action immediately after calling it. --- src/components/alert.js | 3 ++- src/components/confirm/confirm.js | 4 +++- src/components/dialogHelper/dialogHelper.js | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/alert.js b/src/components/alert.js index 7d3ef34dff..a4689c79ac 100644 --- a/src/components/alert.js +++ b/src/components/alert.js @@ -30,8 +30,9 @@ import globalize from '../scripts/globalize'; options = text; } + await appRouter.ready(); + if (useNativeAlert()) { - await appRouter.ready(); alert(replaceAll(options.text || '', '
', '\n')); return Promise.resolve(); } else { diff --git a/src/components/confirm/confirm.js b/src/components/confirm/confirm.js index ac2315f533..0624fb3ffb 100644 --- a/src/components/confirm/confirm.js +++ b/src/components/confirm/confirm.js @@ -35,7 +35,7 @@ async function nativeConfirm(options) { } } -function customConfirm(text, title) { +async function customConfirm(text, title) { let options; if (typeof text === 'string') { options = { @@ -62,6 +62,8 @@ function customConfirm(text, title) { options.buttons = items; + await appRouter.ready(); + return dialog.show(options).then(result => { if (result === 'ok') { return Promise.resolve(); diff --git a/src/components/dialogHelper/dialogHelper.js b/src/components/dialogHelper/dialogHelper.js index fbaf86a024..8a6a22fd15 100644 --- a/src/components/dialogHelper/dialogHelper.js +++ b/src/components/dialogHelper/dialogHelper.js @@ -184,9 +184,7 @@ import '../../assets/css/scrollstyles.scss'; return dlg.getAttribute('data-history') === 'true'; } - export async function open(dlg) { - await appRouter.ready(); - + export function open(dlg) { if (globalOnOpenCallback) { globalOnOpenCallback(dlg); }