Skip to content

Commit 13ffc48

Browse files
committed
fix: resolveRef
1 parent e59a5f2 commit 13ffc48

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/components/JsonSchemaViewer.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,17 @@ export class JsonSchemaViewerComponent extends React.PureComponent<IJsonSchemaVi
7676

7777
@action
7878
public componentDidUpdate(prevProps: Readonly<IJsonSchemaViewer>) {
79-
if (this.treeStore.defaultExpandedDepth !== this.expandedDepth) {
79+
if (prevProps.resolveRef !== this.props.resolveRef) {
80+
this.tree.resolveRef = this.props.resolveRef;
81+
}
82+
83+
if (
84+
this.treeStore.defaultExpandedDepth !== this.expandedDepth ||
85+
prevProps.schema !== this.props.schema ||
86+
prevProps.mergeAllOf !== this.props.mergeAllOf
87+
) {
8088
this.treeStore.defaultExpandedDepth = this.expandedDepth;
8189
this.tree.expandedDepth = this.expandedDepth;
82-
this.renderSchema();
83-
} else if (prevProps.schema !== this.props.schema || prevProps.mergeAllOf !== this.props.mergeAllOf) {
8490
this.tree.mergeAllOf = this.mergeAllOf;
8591
this.tree.schema = this.props.schema;
8692
this.renderSchema();

src/tree/tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export { TreeState as SchemaTreeState };
2121
export class SchemaTree extends Tree {
2222
public expandedDepth: number;
2323
public mergeAllOf: boolean;
24-
protected resolveRef: Optional<SchemaTreeRefDereferenceFn>;
24+
public resolveRef: Optional<SchemaTreeRefDereferenceFn>;
2525

2626
constructor(public schema: JSONSchema4, public state: TreeState, opts: SchemaTreeOptions) {
2727
super();

0 commit comments

Comments
 (0)