(Fix) Prevent accessing `contentWindow` if `iframe` is `null` (#1161)
This commit is contained in:
parent
0b25094b95
commit
fc20ce5775
|
@ -226,9 +226,9 @@ function Apps({ closeModal, closeSnackbar, enqueueSnackbar, openModal }) {
|
||||||
const sendMessageToIframe = useCallback(
|
const sendMessageToIframe = useCallback(
|
||||||
(messageId, data) => {
|
(messageId, data) => {
|
||||||
const app = getSelectedApp()
|
const app = getSelectedApp()
|
||||||
iframeEl.contentWindow.postMessage({ messageId, data }, app.url)
|
iframeEl?.contentWindow.postMessage({ messageId, data }, app.url)
|
||||||
},
|
},
|
||||||
[getSelectedApp, iframeEl.contentWindow],
|
[getSelectedApp, iframeEl],
|
||||||
)
|
)
|
||||||
|
|
||||||
// handle messages from iframe
|
// handle messages from iframe
|
||||||
|
|
Loading…
Reference in New Issue