Skip to content

Commit

Permalink
fix: [JsonViewer] Fix the judgment condition for whether to re-init.
Browse files Browse the repository at this point in the history
  • Loading branch information
rashagu committed Jan 9, 2025
1 parent 1a55fed commit aa3cdad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/semi-ui/jsonViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -81,7 +82,7 @@ class JsonViewerCom extends BaseComponent<JsonViewerProps, JsonViewerState> {
}

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();
}
Expand Down

0 comments on commit aa3cdad

Please sign in to comment.