Merge pull request #4820 from Budibase/fix/preview-event-callbacks

Properly remove window event listener when unmounting component preview
This commit is contained in:
Andrew Kingston 2022-03-08 08:44:13 +00:00 committed by GitHub
commit a4cf6b6197
1 changed files with 2 additions and 1 deletions

View File

@ -134,8 +134,9 @@
// Remove all iframe event listeners on component destroy
onDestroy(() => {
window.removeEventListener("message", receiveMessage)
if (iframe.contentWindow) {
window.removeEventListener("message", receiveMessage)
if (!$store.clientFeatures.messagePassing) {
// Legacy - remove in later versions of BB
iframe.contentWindow.removeEventListener(