From ff9130c49c3ae0433f1858986cc8b18577f67bfe Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 4 Nov 2021 17:28:07 +0100 Subject: [PATCH] tidy up --- packages/client/src/stores/dataSource.js | 9 ++++----- packages/client/src/stores/notification.js | 5 ----- packages/client/src/utils/buttonActions.js | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/client/src/stores/dataSource.js b/packages/client/src/stores/dataSource.js index c60039aa8a..247ba18835 100644 --- a/packages/client/src/stores/dataSource.js +++ b/packages/client/src/stores/dataSource.js @@ -59,11 +59,10 @@ export const createDataSourceStore = () => { // Emit this as a window event, so parent screens which are iframing us in // can also invalidate the same datasource - window.dispatchEvent( - new CustomEvent("invalidate-datasource", { - detail: { dataSourceId }, - }) - ) + window.parent.postMessage({ + type: "close-screen-modal", + detail: { dataSourceId }, + }) let invalidations = [dataSourceId] diff --git a/packages/client/src/stores/notification.js b/packages/client/src/stores/notification.js index 97193b2092..64178328c0 100644 --- a/packages/client/src/stores/notification.js +++ b/packages/client/src/stores/notification.js @@ -34,11 +34,6 @@ const createNotificationStore = () => { icon, }, }) - // window.dispatchEvent( - // new CustomEvent("notification", { - // detail: { message, type, icon }, - // }) - // ) return } diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 11aa033c1d..1fb2284375 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -120,7 +120,7 @@ const changeFormStepHandler = async (action, context) => { const closeScreenModalHandler = () => { // Emit this as a window event, so parent screens which are iframing us in // can close the modal - window.dispatchEvent(new Event("close-screen-modal")) + window.parent.postMessage({ type: "close-screen-modal" }) } const updateStateHandler = action => {