fix: handle null check in PreviewCodeBlock (#15597)
Some checks are pending
CI / build (push) Waiting to run
CI / lint-for-plugins (push) Blocked by required conditions
CI / lint-for-frontend (push) Blocked by required conditions
CI / lint-for-server (push) Blocked by required conditions
CI / unit-test (push) Blocked by required conditions
CI / e2e-test (push) Blocked by required conditions

This commit is contained in:
Manish Kushare 2026-04-21 13:02:47 +05:30 committed by GitHub
parent 7a8041274b
commit 35f2c474fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;