PreTeXtBook/JS_core

race condition when adding highlights

Closed this issue · 1 comments

A highlight is described in terms of the current structure of the paragraph.
If there are two highlights, then the second on (second in time) may depend on the
first (if the first occurs physically before it in the paragraph).

When sequentially adding highlights on page reload, the first one has to finish before
the second can be added (otherwise it is an error or it occurs in the wrong place).
The current way of reloading the page can cause a race condition, and also the
use of async and await is wrong.

Adding old highlights now waits until MathJax has finished. Have not been able to
reproduce the race condition.