fast-reflexes/better-react-mathjax

Feature request: get MathJax to update along with Next.js' fast refresh

nguyenvukhang opened this issue ยท 4 comments

Next.js has a fast-refresh feature which enables real-time previewing of a website while editing source.

I'm using MDX inside of Next.js and while the markdown side of things fast-refresh just fine, the MathJax components require a reload to update.

This is an interesting topic! Will look into it when I have time and will also accept PRs of course :) Thanks for posting!

Apparently this already works! I just needed to set the dynamic property for each MathJax component to true.

Nice!!! Yeah it makes sense indeed ... guess I could introduce some flag that detects whether we are in production or dev and if dev, always set the dynamic flag internally (so that users won't have to use the dynamic flag explicitly when they don't need it in production).

Thanks for getting back to me on this :)

I will leave it open as a reminder to document and look into this if it's ok with you? :)

Extra care taken to enable dynamic prop when running in development mode and when this property is not explicitly set to false.