From aa3cdad8f0d2a2cb15ea34b717c963f1323f5aa8 Mon Sep 17 00:00:00 2001 From: kousum Date: Thu, 9 Jan 2025 14:33:36 +0800 Subject: [PATCH] fix: [JsonViewer] Fix the judgment condition for whether to re-init. --- packages/semi-ui/jsonViewer/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/semi-ui/jsonViewer/index.tsx b/packages/semi-ui/jsonViewer/index.tsx index 69baec8775..5fad1178aa 100644 --- a/packages/semi-ui/jsonViewer/index.tsx +++ b/packages/semi-ui/jsonViewer/index.tsx @@ -20,6 +20,7 @@ import { IconWholeWord, } from '@douyinfe/semi-icons'; import BaseComponent, { BaseProps } from '../_base/baseComponent'; +import {isEqual} from "lodash"; const prefixCls = cssClasses.PREFIX; export type { JsonViewerOptions }; @@ -81,7 +82,7 @@ class JsonViewerCom extends BaseComponent { } componentDidUpdate(prevProps: JsonViewerProps): void { - if (prevProps.options !== this.props.options) { + if (!isEqual(prevProps.options, this.props.options) || this.props.value !== prevProps.value) { this.foundation.jsonViewer.dispose(); this.foundation.init(); }