1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

Handle errors when stringifying component context in case there somehow is a cyclical reference which is unserialisable

This commit is contained in:
Andrew Kingston 2024-03-05 12:10:50 +00:00
parent 97375d1a33
commit 428fdfcc0a

View file

@ -87,8 +87,14 @@ const loadBudibase = async () => {
} else if (type === "request-context") {
const { selectedComponentInstance } = get(componentStore)
const context = selectedComponentInstance?.getDataContext()
let stringifiedContext = null
try {
stringifiedContext = JSON.stringify(context)
} catch (error) {
// Ignore - invalid context
}
eventStore.actions.dispatchEvent("provide-context", {
context: JSON.stringify(context),
context: stringifiedContext,
})
} else if (type === "hover-component") {
hoverStore.actions.hoverComponent(data)