Skip to content

Commit df63c21

Browse files
authored
refactor: only stringify AST JSON when JSON view is active (#368)
1 parent 49969eb commit df63c21

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/components/ast/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const AST: FC = () => {
1717
return <ErrorState message={message} />;
1818
}
1919

20-
const ast = JSON.stringify(result.ast, null, 2);
21-
2220
if (astView === "tree") {
2321
if (result.ast === null) {
2422
return null;
@@ -42,5 +40,5 @@ export const AST: FC = () => {
4240
);
4341
}
4442

45-
return <Editor readOnly value={ast} />;
43+
return <Editor readOnly value={JSON.stringify(result.ast, null, 2)} />;
4644
};

0 commit comments

Comments
 (0)