Conversation
openedx/openedx-platform#33555 upgrades the platform from MathJax 2.7.5 to 4.1.2. v4 removed the queue-based `MathJax.Hub` API in favour of `MathJax.typesetPromise`, so the two `MathJax.Hub.Queue` calls in ORA throw once that lands and math stops rendering in prompts and in submitted responses. The stub in oa_shared.js did not cover this. It only installed a no-op `Hub` when `window.MathJax` was undefined, and under v4 the global is defined, it just has no `Hub`. Route both call sites through a `typesetMath` helper that prefers the v4 API, falls back to the v2 one, and does nothing when the runtime provides no MathJax at all. That last case is what the stub was for, so the stub goes away. Supporting both versions means this does not have to be sequenced against the platform upgrade. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Regenerated with `make static` for the MathJax helper change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2454 +/- ##
=======================================
Coverage 95.46% 95.46%
=======================================
Files 198 198
Lines 22842 22842
Branches 1551 1551
=======================================
Hits 21807 21807
Misses 780 780
Partials 255 255
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR - ORA's two MathJax calls use the v2
MathJax.HubAPI, which MathJax v4 removed. openedx/edx-platform#33555 upgrades the platform to 4.1.2, and when it lands those calls throw and math stops rendering in ORA prompts and submitted responses. This routes them through a helper that works on both v2 and v4, so it can merge now rather than being sequenced against the platform upgrade.What changed?
oa_mathjax.jsexportingtypesetMath(element). It prefers v4'sMathJax.typesetPromise, falls back to v2'sMathJax.Hub.Queue, and does nothing when the runtime provides no MathJax.oa_server.js::renderLatexandlms/oa_base.js::bindLatexPreviewnow call it instead ofMathJax.Hub.Queuedirectly.oa_shared.js. It guarded ontypeof window.MathJax === 'undefined', which is false under v4, so it never engaged where it was needed. The helper covers the no-MathJax case it existed for.Testing Instructions
make test-jspasses: 288 of 289, and the one failure is a pre-existing flake in the "unsubmitted assessments" specs that also fails onmaster(it moves betweenoa_self.jsandoa_staff_area.jswith Jasmine's random spec order). Notemake test-jsrather thannpm test, since the fixtures come from therender-templatesstep.The bug itself reproduces without the branch: with the global set to
{}, which is what v4 presents, the oldMathJax.Hub.Queue(['Typeset', MathJax.Hub, el])raisesTypeError: Cannot read properties of undefined (reading 'Queue'). Thedoes not throw when MathJax is v4-shaped but not readyspec covers that state against the new helper.To check it by hand, open an ORA with latex enabled and confirm math renders in the prompt, in the response preview, and in a submitted response, on a platform serving either MathJax version.