Closed guanghechen closed 1 year ago
Close this pr as it fix nothing.
Thanks for contributing! I'm sorry the fix didn't work ... is there an alternate fix? Could you supply a code sandbox showing the problem and I can see how it can be fixed? Thanks for trying :)
Hi @fast-reflexes , thanks for the reply!
I have tried many ways to fix this problem but got nothing. The issue is that when switching routes, components will be unmounted and then re-mounted, but equation numbers are not cleared. I created a demo to show the problem, see https://codesandbox.io/s/vigorous-bird-h7fsuw?file=/src/App.js, hope it helps :)
re-render
button
Hi @fast-reflexes , thank you for creating such a awesome project, I'm really appreciate it! But I encountered a typesetting bug when using this package, so I create this pr and hope this pr can fix it.
Scenario
In a single-page application, when we switch routes and trigger the MathJax to re-render the page, if a formula in the page uses the
\label
instruction, it will cause theLabel multiple 'xxx' defined
error.Changes
fix: reset equation numbers before reprocess to avoid
Label multiple defined
error.Before![image](https://user-images.githubusercontent.com/42513619/198005286-76469cd5-a343-4ab9-bce1-a006841015de.png)
After![image](https://user-images.githubusercontent.com/42513619/198005355-1dbec688-fe37-4974-a752-2404a4c0e10d.png)