Add logic to prevent sidepanel and modals from closing when onload actions are active.
This commit is contained in:
parent
e3705f1e87
commit
6eeffb43ef
|
@ -51,6 +51,7 @@
|
||||||
let dataLoaded = false
|
let dataLoaded = false
|
||||||
let permissionError = false
|
let permissionError = false
|
||||||
let embedNoScreens = false
|
let embedNoScreens = false
|
||||||
|
let onLoadCheck = false
|
||||||
|
|
||||||
// Determine if we should show devtools or not
|
// Determine if we should show devtools or not
|
||||||
$: showDevTools = $devToolsEnabled && !$routeStore.queryParams?.peek
|
$: showDevTools = $devToolsEnabled && !$routeStore.queryParams?.peek
|
||||||
|
@ -106,12 +107,24 @@
|
||||||
}
|
}
|
||||||
const handleHashChange = () => {
|
const handleHashChange = () => {
|
||||||
const { open: sidePanelOpen } = $sidePanelStore
|
const { open: sidePanelOpen } = $sidePanelStore
|
||||||
if (sidePanelOpen) {
|
// only close if the sidepanel is open and theres no onload side panel actions on the screen.
|
||||||
|
if (
|
||||||
|
sidePanelOpen &&
|
||||||
|
!$screenStore.activeScreen.onLoad?.some(
|
||||||
|
item => item["##eventHandlerType"] === "Open Side Panel"
|
||||||
|
)
|
||||||
|
) {
|
||||||
sidePanelStore.actions.close()
|
sidePanelStore.actions.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
const { open: modalOpen } = $modalStore
|
const { open: modalOpen } = $modalStore
|
||||||
if (modalOpen) {
|
// only close if the modal is open and theres onload modals actions on the screen.
|
||||||
|
if (
|
||||||
|
modalOpen &&
|
||||||
|
!$screenStore.activeScreen.onLoad?.some(
|
||||||
|
item => item["##eventHandlerType"] === "Open Modal"
|
||||||
|
)
|
||||||
|
) {
|
||||||
modalStore.actions.close()
|
modalStore.actions.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue