From 4bbbd75a4e9fe92445c957d291a25c4268cb1039 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 7 Dec 2021 15:11:13 +0000 Subject: [PATCH] Fix datasource invalidations not propagating through peek modals --- packages/client/src/stores/dataSource.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/client/src/stores/dataSource.js b/packages/client/src/stores/dataSource.js index ee615b8bfb..46ac0b6c86 100644 --- a/packages/client/src/stores/dataSource.js +++ b/packages/client/src/stores/dataSource.js @@ -1,6 +1,7 @@ import { writable, get } from "svelte/store" import { fetchTableDefinition } from "../api" import { FieldTypes } from "../constants" +import { routeStore } from "./routes" export const createDataSourceStore = () => { const store = writable([]) @@ -60,10 +61,13 @@ export const createDataSourceStore = () => { // Emit this as a window event, so parent screens which are iframing us in // can also invalidate the same datasource - window.parent.postMessage({ - type: "close-screen-modal", - detail: { dataSourceId }, - }) + const inModal = get(routeStore).queryParams?.peek + if (inModal) { + window.parent.postMessage({ + type: "invalidate-datasource", + detail: { dataSourceId }, + }) + } let invalidations = [dataSourceId]