Ver Fonte

Read window.MathJax.Hub outside the timeout (#11431)

GitOrigin-RevId: 6a9f3cd2a7811059b7d1d95b411b37a41cb35b83
Alf Eaton há 3 anos atrás
pai
commit
adca4980db

+ 3 - 6
services/web/frontend/js/features/chat/components/message-content.tsx

@@ -19,14 +19,11 @@ const MessageContent: FC<{ content: string }> = ({ content }) => {
 
       // MathJax v2 typesetting
       if (window.MathJax?.Hub) {
+        const { Hub } = window.MathJax
+
         const timeout = setTimeout(() => {
           configureMathJax()
-
-          window.MathJax.Hub.Queue([
-            'Typeset',
-            window.MathJax.Hub,
-            root.current,
-          ])
+          Hub.Queue(['Typeset', Hub, root.current])
         }, 0)
 
         return () => clearTimeout(timeout)