fkling / fkling/astexplorer

Switch from Tree to JSON -> "An error was caught while rendering the AST. This usually is an issue with astexplorer itself."

Open
#715 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.5k
Forks
772
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Switching from Tree to JSON tab results in this message:
_"An error was caught while rendering the AST. This usually is an issue with astexplorer itself. Have a look at the console for more information. Consider filing a bug report, but check first if one doesn"t already exist. Thank you!"_

The message told me to file a bug report, so I am.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to https://astexplorer.net/
1. Select @babel/parser
1. Paste provided sample javascript in left side panel:
[crash demo.js.txt](https://github.com/fkling/astexplorer/files/14951859/crash.demo.js.txt)
1. Wait for parse and right side panel to update
Observe Tree panel is working properly (afaik) and is navigable
1. Switch from Tree to JSON tab
_"An error was caught while rendering the AST."_
1. Switch back from JSON tab to Tree
_"An error was caught while rendering the AST."_
1. Type some new javascript into left panel.
Observe right side panel is functional again. Both the Tree and JSON tabs work.

**Expected behavior**
Json string appears when JSON tab is clicked when using provided sample javascript.

**Browser (please complete the following information):**
- Chromium 122.0.6261.85 on Windows

**astexplorer settings:**
- Selected parser: `@babel/parser`
- Selected transformer (if applicable): n/a

-------

#### Using other parsers:
- `acorn`: JSON tab works
- `typescript`: JSON tab broken

#### Other notes
The sample javascript provided is not mine and I cannot guarantee it is free of errors. If some parsers are choking on this sample javascript while others can handle it, then a detection and message explaining this to the user could be helpful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.