Skip to content

Commit 882278d

Browse files
committed
load mathjax on updating markdown prop
1 parent 44be039 commit 882278d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/dash-core-components/src/fragments/Math.react.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import PropTypes from 'prop-types';
22
import React, {Component} from 'react';
33

4+
import lazyLoadMathJax from '../utils/LazyLoader/mathjax';
5+
46
export default class DashMath extends Component {
57
constructor(props) {
68
super(props);
@@ -21,9 +23,10 @@ export default class DashMath extends Component {
2123
}
2224

2325
renderMath() {
24-
if (window.MathJax?.typeset) {
25-
window.MathJax.typeset([this.span_element.current]);
26-
}
26+
const current = this.span_element.current;
27+
lazyLoadMathJax().then(function () {
28+
window.MathJax.typeset([current]);
29+
});
2730
}
2831

2932
render() {

0 commit comments

Comments
 (0)