Skip to content

Commit 8582449

Browse files
authored
Merge pull request #413 from se7entyse7en/uast-viewer-pane-nodes-expansion
Fixes initialization of `UASTViewer`
2 parents 38074aa + 6271723 commit 8582449

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

frontend/src/components/UASTViewer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class UASTViewer extends Component {
1616

1717
this.state = {
1818
loading: false,
19-
flatUast: this.transform(props.uast),
19+
initialFlatUast: this.transform(props.uast),
2020
showLocations: false,
2121
filter: '',
2222
error: null
@@ -65,9 +65,9 @@ class UASTViewer extends Component {
6565
}
6666

6767
render() {
68-
const { flatUast, error, loading } = this.state;
68+
const { initialFlatUast, error, loading } = this.state;
6969
const { showLocations, filter } = this.state;
70-
const uastViewerProps = { flatUast };
70+
const uastViewerProps = { initialFlatUast };
7171

7272
return (
7373
<div className="pg-uast-viewer">

frontend/src/components/UASTViewerPane.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ function UASTViewerPane({
4141
}) {
4242
let content = null;
4343

44+
const uast = uastViewerProps.flatUast || uastViewerProps.initialFlatUast;
4445
if (loading) {
4546
content = <div>loading...</div>;
46-
} else if (uastViewerProps.flatUast) {
47-
const searchResults = getSearchResults(uastViewerProps.flatUast);
47+
} else if (uast) {
48+
const searchResults = getSearchResults(uast);
4849
const rootIds = searchResults || [ROOT_ID];
4950

5051
if (searchResults && !searchResults.length) {

0 commit comments

Comments
 (0)