Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(website): prevent playground formatted editor from being empty on navigation #699

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

jtkiesel
Copy link
Contributor

What changed with this PR:

Website's playground no longer displays an empty formatted (read-only) editor when navigating to another page and then back to the playground.

There seems to be a bug in Monaco Editor for React where in certain situations, updating its value prop immediately after rendering the component for the first time causes it to continue rendering the original value. I verified that the component was being passed the formatted code as its value 2nd, after initially setting it to empty, and yet it was rendering empty.

This fix works around that apparent bug by no longer rendering the component at all on the initial render, meaning it will only render the formatted (read-only) editor after Prettier formats it.

@jtkiesel jtkiesel merged commit ab694db into main Oct 29, 2024
11 checks passed
@jtkiesel jtkiesel deleted the fix/playground-navigation branch October 29, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant