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 2f23ef3e9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(