diff --git a/src/components/JsonSchemaViewer.tsx b/src/components/JsonSchemaViewer.tsx index cf658423..4ede01db 100644 --- a/src/components/JsonSchemaViewer.tsx +++ b/src/components/JsonSchemaViewer.tsx @@ -76,11 +76,17 @@ export class JsonSchemaViewerComponent extends React.PureComponent) { - if (this.treeStore.defaultExpandedDepth !== this.expandedDepth) { + if (prevProps.resolveRef !== this.props.resolveRef) { + this.tree.resolveRef = this.props.resolveRef; + } + + if ( + this.treeStore.defaultExpandedDepth !== this.expandedDepth || + prevProps.schema !== this.props.schema || + prevProps.mergeAllOf !== this.props.mergeAllOf + ) { this.treeStore.defaultExpandedDepth = this.expandedDepth; this.tree.expandedDepth = this.expandedDepth; - this.renderSchema(); - } else if (prevProps.schema !== this.props.schema || prevProps.mergeAllOf !== this.props.mergeAllOf) { this.tree.mergeAllOf = this.mergeAllOf; this.tree.schema = this.props.schema; this.renderSchema(); diff --git a/src/tree/tree.ts b/src/tree/tree.ts index 5e67a210..d5d50469 100644 --- a/src/tree/tree.ts +++ b/src/tree/tree.ts @@ -21,7 +21,7 @@ export { TreeState as SchemaTreeState }; export class SchemaTree extends Tree { public expandedDepth: number; public mergeAllOf: boolean; - protected resolveRef: Optional; + public resolveRef: Optional; constructor(public schema: JSONSchema4, public state: TreeState, opts: SchemaTreeOptions) { super();