From 35f2c474fdac4d7200fea2d70ebccae16238ee49 Mon Sep 17 00:00:00 2001 From: Manish Kushare <37823141+manishkushare@users.noreply.github.com> Date: Tue, 21 Apr 2026 13:02:47 +0530 Subject: [PATCH] fix: handle null check in PreviewCodeBlock (#15597) --- frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx b/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx index f9aef2fb67..02bd3716f9 100644 --- a/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx +++ b/frontend/src/AppBuilder/CodeEditor/PreviewBox.jsx @@ -134,7 +134,7 @@ export const PreviewBox = ({ const globalServerConstantsRegex = /\{\{.*globals\.server.*\}\}/; const getPreviewContent = (content, type) => { - if (content === undefined || content === null) return currentValue; + if (content === undefined) return currentValue; try { switch (type) { case 'Object': @@ -741,7 +741,7 @@ const PreviewCodeBlock = ({ code, isExpectValue = false, isLargeDataset }) => { const typeOfValue = typeof prettyPrintedJson; - if (typeOfValue === 'object' || typeOfValue === 'array') { + if (prettyPrintedJson !== null && (typeOfValue === 'object' || typeOfValue === 'array')) { showJSONTree = true; } else { prettyPrintedJson = preview;