fix(ui): release interrupted markdown highlight jobs

This commit is contained in:
marius-kilocode
2026-05-26 10:33:58 +02:00
parent 6b96c987e7
commit 24d8311ab4
2 changed files with 2 additions and 2 deletions
@@ -57,5 +57,6 @@ describe("Markdown rAF-coalesced parse — regression guard", () => {
expect(src).toContain("preserveStreamingHighlight(fromEl, toEl, local.streaming ?? false)")
expect(body).toContain("export function preserveStreamingHighlight")
expect(body).toMatch(/continues\(before, after\)[\s\S]*queue\(from, after, lang\)/)
expect(body).toMatch(/const done = \(\) => \{\s*job\.busy = false\s*if \(!pre\.isConnected\) return/)
})
})
@@ -61,13 +61,12 @@ function run(pre: HTMLPreElement, job: Job) {
const lang = job.lang
job.busy = true
const done = () => {
job.busy = false
if (!pre.isConnected) return
if (job.code !== code || job.lang !== lang) {
job.busy = false
run(pre, job)
return
}
job.busy = false
}
void refresh(pre, code, lang).then(done, done)
}