Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@iamllama
Copy link
Contributor

@iamllama iamllama commented Feb 18, 2025

#3827 deals with stalling when editing in the richtext editor's mathjax overlay editor. But when the plaintext editor is changed, all the mathjax custom element components are recreated* and thus rerendered on each change.

This can be much slower since now all the mathjax expressions in the field are re-rendered even if none of them were changed

The fix proposed here is to add and use lru-cache (an existing indirect dep) to cache the rendered svg. A max cache size of 10 is chosen to limit memory use, and should account for most normal usecases with <10 mathjax exprs per field

*this seems to have been noted already in #1502 (comment). it's also why the debouncing within the component has no effect here

@dae
Copy link
Member

dae commented Feb 18, 2025

LGTM - thank you!

@dae dae merged commit 1c8c5a4 into ankitects:main Feb 18, 2025
1 check passed
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.

2 participants