Skip to content

Commit

Permalink
Merge pull request #413 from se7entyse7en/uast-viewer-pane-nodes-expa…
Browse files Browse the repository at this point in the history
…nsion

Fixes initialization of `UASTViewer`
  • Loading branch information
se7entyse7en authored Apr 19, 2019
2 parents 38074aa + 6271723 commit 8582449
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/UASTViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UASTViewer extends Component {

this.state = {
loading: false,
flatUast: this.transform(props.uast),
initialFlatUast: this.transform(props.uast),
showLocations: false,
filter: '',
error: null
Expand Down Expand Up @@ -65,9 +65,9 @@ class UASTViewer extends Component {
}

render() {
const { flatUast, error, loading } = this.state;
const { initialFlatUast, error, loading } = this.state;
const { showLocations, filter } = this.state;
const uastViewerProps = { flatUast };
const uastViewerProps = { initialFlatUast };

return (
<div className="pg-uast-viewer">
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/UASTViewerPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ function UASTViewerPane({
}) {
let content = null;

const uast = uastViewerProps.flatUast || uastViewerProps.initialFlatUast;
if (loading) {
content = <div>loading...</div>;
} else if (uastViewerProps.flatUast) {
const searchResults = getSearchResults(uastViewerProps.flatUast);
} else if (uast) {
const searchResults = getSearchResults(uast);
const rootIds = searchResults || [ROOT_ID];

if (searchResults && !searchResults.length) {
Expand Down

0 comments on commit 8582449

Please sign in to comment.