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 f64e67c commit cfbc620
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/semi-ui-vue/src/components/jsonViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
import { CombineProps } from '../interface';
import { vuePropsMake } from '../PropTypes';
import { styleNum } from '../_utils';
import { isEqual } from 'lodash';
const prefixCls = cssClasses.PREFIX;

export type { JsonViewerOptions };
Expand Down Expand Up @@ -138,8 +139,11 @@ const JsonViewerCom = defineComponent({
onMounted(()=>{
foundation.init();
})
watch(()=>props.options, (value, oldValue, onCleanup)=>{
if (oldValue !== value) {
watch([
()=>props.options,
()=>props.value,
], ([options, value], [oldOptions, oldValue], onCleanup)=>{
if (oldValue !== value || !isEqual(options, oldOptions)) {
foundation.jsonViewer.dispose();
foundation.init();
}
Expand Down

0 comments on commit cfbc620

Please sign in to comment.