Merge pull request #14182 from Budibase/budi-8455-on-screen-load-open-side-panel-issue-side-panel-will-open

Add logic to prevent panel and modals from closing when screen load actions are available
This commit is contained in:
Martin McKeaveney 2024-07-23 13:37:33 +01:00 committed by GitHub
commit 799643b227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 2 deletions

View File

@ -106,12 +106,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()
} }
} }