From d79fc356ea70224c3e5f90cfe86cf0564c7277c2 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 3 Nov 2022 12:50:52 +0000 Subject: [PATCH 1/2] Fix for #8491 - auto generated screens use the form block now which had an issue with the close screen event not providing a URL. --- packages/client/src/components/app/blocks/FormBlock.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/components/app/blocks/FormBlock.svelte b/packages/client/src/components/app/blocks/FormBlock.svelte index 3311ddd7bb..d1d1a0a22f 100644 --- a/packages/client/src/components/app/blocks/FormBlock.svelte +++ b/packages/client/src/components/app/blocks/FormBlock.svelte @@ -48,6 +48,9 @@ }, { "##eventHandlerType": "Close Screen Modal", + parameters: { + url: actionUrl, + }, }, { "##eventHandlerType": "Navigate To", @@ -68,6 +71,9 @@ }, { "##eventHandlerType": "Close Screen Modal", + parameters: { + url: actionUrl, + }, }, { "##eventHandlerType": "Navigate To", From 04f1f983e4b22c8d47923a9f40f3df0ab54c32da Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 3 Nov 2022 13:23:29 +0000 Subject: [PATCH 2/2] Fix to allow close screen modal without navigating to a new page. --- packages/client/src/components/app/blocks/FormBlock.svelte | 6 ------ packages/client/src/utils/buttonActions.js | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/app/blocks/FormBlock.svelte b/packages/client/src/components/app/blocks/FormBlock.svelte index d1d1a0a22f..3311ddd7bb 100644 --- a/packages/client/src/components/app/blocks/FormBlock.svelte +++ b/packages/client/src/components/app/blocks/FormBlock.svelte @@ -48,9 +48,6 @@ }, { "##eventHandlerType": "Close Screen Modal", - parameters: { - url: actionUrl, - }, }, { "##eventHandlerType": "Navigate To", @@ -71,9 +68,6 @@ }, { "##eventHandlerType": "Close Screen Modal", - parameters: { - url: actionUrl, - }, }, { "##eventHandlerType": "Navigate To", diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index e44ed2451c..6fcef37182 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -225,7 +225,10 @@ const changeFormStepHandler = async (action, context) => { } const closeScreenModalHandler = action => { - let { url } = action.parameters + let url + if (action?.parameters) { + url = action.parameters.url + } // Emit this as a window event, so parent screens which are iframing us in // can close the modal window.parent.postMessage({ type: "close-screen-modal", url })