Bugfix: screenOnRoute sometimes failed

This commit is contained in:
the-djmaze 2023-02-11 20:41:54 +01:00
parent 415102aa37
commit e4b0d43b3d

View file

@ -169,22 +169,14 @@ const
* @returns {void}
*/
screenOnRoute = (screenName, subPart) => {
let vmScreen = null,
isSameScreen = false;
if (null == screenName || '' == screenName) {
screenName = defaultScreenName;
}
if (fireEvent('sm-show-screen', screenName, 1)) {
screenName = screenName || defaultScreenName;
if (screenName && fireEvent('sm-show-screen', screenName, 1)) {
// Close all popups
for (let vm of visiblePopups) {
(false === vm.onClose()) || vm.close();
}
if (screenName) {
vmScreen = screen(screenName);
let vmScreen = screen(screenName);
if (!vmScreen) {
vmScreen = screen(defaultScreenName);
if (vmScreen) {
@ -194,7 +186,7 @@ const
}
if (vmScreen?.__started) {
isSameScreen = currentScreen && vmScreen === currentScreen;
let isSameScreen = currentScreen && vmScreen === currentScreen;
if (!vmScreen.__builded) {
vmScreen.__builded = true;
@ -231,7 +223,6 @@ const
}, 1);
}
}
}
};