From c080f40a983d1ba5050112236804ad4ce4dfec2d Mon Sep 17 00:00:00 2001 From: 2betop <2698393+2betop@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:16:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20debug=20=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=89=93=E5=8D=B0=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/utils/debug.tsx | 245 ++++++++++-------- .../amis-core/src/utils/renderer-event.ts | 10 + 2 files changed, 148 insertions(+), 107 deletions(-) diff --git a/packages/amis-core/src/utils/debug.tsx b/packages/amis-core/src/utils/debug.tsx index 06de32844ec..c2b3e4f8aba 100644 --- a/packages/amis-core/src/utils/debug.tsx +++ b/packages/amis-core/src/utils/debug.tsx @@ -12,6 +12,7 @@ import {uuidv4, importLazyComponent} from './helper'; import position from './position'; import {resolveVariableAndFilter} from './resolveVariableAndFilter'; import {callStrFunction} from './api'; +import isPlainObject from 'lodash/isPlainObject'; export const JsonView = React.lazy(() => import('react-json-view').then(importLazyComponent) @@ -102,21 +103,25 @@ const LogView = observer(({store}: {store: AMISDebugStore}) => { return ( <> {logs.map((log, index) => { + let ext = + typeof log.ext === 'string' && + (log.ext.startsWith('{') || log.ext.startsWith('[')) + ? parseJson(log.ext) + : typeof log.ext === 'object' + ? normalizeDataForLog(log.ext) + : log.ext; + return (
{JSON.stringify(log.ext)}+
{JSON.stringify(ext)})} ); @@ -260,119 +265,121 @@ const AMISDebug = observer(({store}: {store: AMISDebugStore}) => { )} -