From 2675ccf673efa985f50483186bb854ac4c0f93f0 Mon Sep 17 00:00:00 2001 From: David Newell Date: Fri, 10 Oct 2025 11:54:51 +0100 Subject: [PATCH] fix: copying JSON attribute objects (#38733) --- .../src/scenes/notebooks/Nodes/NodeWrapper.tsx | 17 ++++++++++++++++- .../scenes/notebooks/Nodes/notebookNodeLogic.ts | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx b/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx index 758029ae8f..36ad12921d 100644 --- a/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx @@ -403,6 +403,21 @@ export function createPostHogWidgetNode( }, addAttributes() { + const nodeAttributes = Object.fromEntries( + Object.entries(attributes as Record).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( }, __init: { default: null }, children: {}, - ...attributes, + ...nodeAttributes, } }, diff --git a/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts b/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts index b8f537137d..6eefb3e7ee 100644 --- a/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts +++ b/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts @@ -296,7 +296,7 @@ export const notebookNodeLogic = kea([ return '' } - return `${key}='${JSON.stringify(value)}'` + return `${key}='${btoa(JSON.stringify(value))}'` }) .filter((x) => !!x) .join(' ')