Skip to content

Commit d84c154

Browse files
authored
Merge pull request #823 from mathjax/issue2873
Fix issue where lazy typesetting would re-typeset expressions unnecessarily. (mathjax/MathJax#2873)
2 parents 340694e + 4e4f7ae commit d84c154

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ts/ui/lazy/LazyHandler.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ export function LazyMathItemMixin<N, T, D, B extends Constructor<HTMLMathItem<N,
215215
}
216216
}
217217

218+
/**
219+
* Only update the state if restore is true or false (null is used for setting lazy states)
220+
* @override
221+
*/
222+
public state(state: number = null, restore: boolean = false) {
223+
if (restore !== null) super.state(state, restore);
224+
return super.state();
225+
}
226+
218227
/**
219228
* Initially, just insert a marker for where the math will go, and
220229
* track it in the lazy list. Then, when it comes into view,
@@ -616,7 +625,7 @@ B extends MathDocumentConstructor<HTMLDocument<N, T, D>>>(
616625
let compile = false;
617626
for (const item of this.math) {
618627
const earlier = item as LazyMathItem<N, T, D>;
619-
if (earlier === math || !earlier?.lazyCompile) {
628+
if (earlier === math || !earlier?.lazyCompile || !earlier.lazyTex) {
620629
break;
621630
}
622631
earlier.lazyCompile = false;

0 commit comments

Comments
 (0)