1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

Allow app preview to handle garbage iframe messages

This commit is contained in:
Andrew Kingston 2021-08-01 14:00:18 +01:00
parent e332003cb7
commit 06fa9091f4

View file

@ -47,6 +47,18 @@ export default `
return
}
// Parse received message
// If parsing fails, just ignore and wait for the next message
let parsed
try {
parsed = JSON.parse(event.data)
} catch (error) {
// Ignore
}
if (!parsed) {
return
}
// Extract data from message
const {
selectedComponentId,
@ -55,7 +67,7 @@ export default `
previewType,
appId,
theme
} = JSON.parse(event.data)
} = parsed
// Set some flags so the app knows we're in the builder
window["##BUDIBASE_IN_BUILDER##"] = true