fix: copying JSON attribute objects (#38733)

This commit is contained in:
David Newell
2025-10-10 11:54:51 +01:00
committed by GitHub
parent a781bc09dc
commit 2675ccf673
2 changed files with 17 additions and 2 deletions

View File

@@ -403,6 +403,21 @@ export function createPostHogWidgetNode<T extends CustomNotebookNodeAttributes>(
},
addAttributes() {
const nodeAttributes = Object.fromEntries(
Object.entries(attributes as Record<string, any>).map(([name, config]) => {
return [
name,
{
...config,
parseHTML: (element: HTMLElement) => {
const attribute = element.getAttribute(name)
return attribute ? JSON.parse(atob(attribute)) : null
},
},
]
})
)
return {
height: {},
title: {},
@@ -411,7 +426,7 @@ export function createPostHogWidgetNode<T extends CustomNotebookNodeAttributes>(
},
__init: { default: null },
children: {},
...attributes,
...nodeAttributes,
}
},

View File

@@ -296,7 +296,7 @@ export const notebookNodeLogic = kea<notebookNodeLogicType>([
return ''
}
return `${key}='${JSON.stringify(value)}'`
return `${key}='${btoa(JSON.stringify(value))}'`
})
.filter((x) => !!x)
.join(' ')