mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.77k stars 1.14k forks source link

Fix reset of playground render errors #2392

Closed ManasMakde closed 1 year ago

ManasMakde commented 1 year ago

The error boundary does not automatically reset on changing the text value, To fix it the value state was added to the resetKeys in ErrorBoundary

You can see the difference on the official site vs localhost:

https://github.com/mdx-js/mdx/assets/73928607/ce24eb47-b9f9-41be-8882-a5d1c54ad9be

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mdx ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2023 6:26am
codecov-commenter commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (efff74e) 100.00% compared to head (5c6b494) 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2392 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 23 23 Lines 2689 2689 Branches 2 2 ========================================= Hits 2689 2689 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

wooorm commented 1 year ago

a) it does seem to work for me? 🤔 b) there’s a button under the error you could click if not? c) I see no docs on what resetKeys does?

ManasMakde commented 1 year ago

a) I don't understand what you mean?

b) The button works but it feels too tedious & disturbs the typing flow and it would be quite nice feature given the change is only 1 line :)

c) I didn't find it either but I found this solution on stackoverflow, Best I could tell is that resetKeys contains an array & whenever any one of it's values changes the boundary rechecks for error i.e. the reset Key


Edit

My bad, I linked to the wrong stackoverflow solution and I can't find the original one but this pretty much explains resetKeys

wooorm commented 1 year ago

a) I don't understand what you mean?

You have a bug. I don’t have that bug

c) I didn't find it either but I found this solution on stackoverflow

That seems to be about key? Which is a React thing, unrelated to this package, although it indeed resets when it changes


Anyway, if this didn’t work for you and does not, sure, we can try it!

wooorm commented 1 year ago

Thank you!