From adca4980db11188ae8b03e9108952094e70766b7 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 25 Jan 2023 10:13:05 +0000 Subject: [PATCH] Read window.MathJax.Hub outside the timeout (#11431) GitOrigin-RevId: 6a9f3cd2a7811059b7d1d95b411b37a41cb35b83 --- .../js/features/chat/components/message-content.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/services/web/frontend/js/features/chat/components/message-content.tsx b/services/web/frontend/js/features/chat/components/message-content.tsx index 790b39b9e3..58a5610abe 100644 --- a/services/web/frontend/js/features/chat/components/message-content.tsx +++ b/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)