MathJax / Runestone rendering race condition

11 views
Skip to first unread message

Andrew Scholer

unread,
Nov 14, 2025, 11:52:40 AM (9 days ago) Nov 14
to prete...@googlegroups.com
While looking at Chrissy's sample page from another post, I noticed some rendering issues with MathJax in Runestone components. In particular, matching widgets and Parsons, though I am not sure it is restricted to those widgets.

Pretty reliably, if I refresh while looking at that content, I get:
image.png

The Parsons below that looks like:
image.png


In the log I get:
"Uncaught (in promise) TypeError: Cannot read properties of null (reading 'replaceChild')" from tex-chtml.js

It looks like MathJax might be trying to render those blocks while the original source is being transformed by the RS code.

It seems like there must be a race condition involved as the first load of the page is more likely to work than a refresh. And Firefox doesn't seem to exhibit the same behavior.

Andrew Scholer

Rob Beezer

unread,
Nov 14, 2025, 2:25:59 PM (9 days ago) Nov 14
to prete...@googlegroups.com
And when I followed Chrissy's link, I noticed that the very tip-top of the page
had a few (3-5) bits of inline math which were not rendering, either.

Not because I think it will solve everything (or anything), but I'd really like
to move to MJ4 and get these sorts of things sorted out in that configuration.
Effort into MJ3 seems better directed elsewhere? (Not to discourage debugging
this present problem!)

Rob

On 11/14/25 08:52, Andrew Scholer wrote:
> While looking at Chrissy's sample page from another post, I noticed some
> rendering issues with MathJax in Runestone components. In particular, matching
> widgets and Parsons, though I am not sure it is restricted to those widgets.
>
> Link to page I noticed it on:
> https://tanaquil18.github.io/matrixcalculations/sec-LUdecomposition.html#rqs-
> LUdecomposition <https://tanaquil18.github.io/matrixcalculations/sec-
> LUdecomposition.html#rqs-LUdecomposition>
>
> Pretty reliably, if I refresh while looking at that content, I get:
> image.png
>
> The Parsons below that looks like:
> image.png
>
>
> In the log I get:
> "Uncaught (in promise) TypeError: Cannot read properties of null (reading
> 'replaceChild')" from tex-chtml.js
>
> It looks like MathJax might be trying to render those blocks while the original
> source is being transformed by the RS code.
>
> It seems like there must be a race condition involved as the first load of the
> page is more likely to work than a refresh. And Firefox doesn't seem to exhibit
> the same behavior.
>
> Andrew Scholer
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-ABoCPVaaYgteJgE4tg%40mail.gmail.com <https://
> groups.google.com/d/msgid/pretext-dev/CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-
> ABoCPVaaYgteJgE4tg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Chrissy Safranski

unread,
Nov 14, 2025, 2:49:41 PM (9 days ago) Nov 14
to PreTeXt development
This has been driving me crazy (okay, crazier).  It comes and goes and I couldn't figure out a rhyme or reason why. It happens when I do pretext view a lot, less when I'm looking at a deployed page, and more in Chrome than in Firefox.  But I thought maybe it was just me.

Thank you for noting this! 
Chrissy

Rob Beezer

unread,
Nov 14, 2025, 2:56:13 PM (9 days ago) Nov 14
to prete...@googlegroups.com
No, you are not crazy, Chrissy!

Shoulda said - Firefox for me.

And I've had this problem with the sample article totally hanging up when served
for pretextbook.org, by some appearances due to the MathJax CDN. (Could be
related to that site migrating to new servers...)

Something is afoot, it feels like.

Rob

On 11/14/25 11:49, Chrissy Safranski wrote:
> This has been driving me crazy (okay, crazier).  It comes and goes and I
> couldn't figure out a rhyme or reason why. It happens when I do pretext view a
> lot, less when I'm looking at a deployed page, and more in Chrome than in
> Firefox.  But I thought maybe it was just me.
>
> Thank you for noting this!
> Chrissy
>
> On Friday, November 14, 2025 at 2:25:59 PM UTC-5 Rob Beezer wrote:
>
> And when I followed Chrissy's link, I noticed that the very tip-top of the page
> had a few (3-5) bits of inline math which were not rendering, either.
>
> Not because I think it will solve everything (or anything), but I'd really like
> to move to MJ4 and get these sorts of things sorted out in that configuration.
> Effort into MJ3 seems better directed elsewhere? (Not to discourage debugging
> this present problem!)
>
> Rob
>
> On 11/14/25 08:52, Andrew Scholer wrote:
> > While looking at Chrissy's sample page from another post, I noticed some
> > rendering issues with MathJax in Runestone components. In particular,
> matching
> > widgets and Parsons, though I am not sure it is restricted to those widgets.
> >
> > Link to page I noticed it on:
> > https://tanaquil18.github.io/matrixcalculations/sec-
> LUdecomposition.html#rqs- <https://tanaquil18.github.io/matrixcalculations/
> sec-LUdecomposition.html#rqs->
> > LUdecomposition <https://tanaquil18.github.io/matrixcalculations/sec-
> dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> > CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-ABoCPVaaYgteJgE4tg%40mail.gmail.com
> <http://40mail.gmail.com> <https://
> > groups.google.com/d/msgid/pretext-dev/CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05-
> <http://groups.google.com/d/msgid/pretext-dev/
> CACm44N8e7D1j3ACSJdTbXaz52%2BFRh05->
> > ABoCPVaaYgteJgE4tg%40mail.gmail.com?utm_medium=email&utm_source=footer
> <http://40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/09cfde56-e6da-438a-ada7-8e9e63859028n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/09cfde56-e6da-438a-
> ada7-8e9e63859028n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages