SD-2505 - fix: avoid UI stalls with on Typo.js example#2765
SD-2505 - fix: avoid UI stalls with on Typo.js example#2765chittolinag wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02dbe3d671
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const onAbort = () => { | ||
| pending.delete(requestId); | ||
| cleanup(); | ||
| reject(createAbortError()); |
There was a problem hiding this comment.
Prevent abort handler from dropping uncancelled worker checks
If a proofing batch takes longer than timeoutMs (10s default in ProofingSessionManager), this abort handler rejects immediately and removes the request from pending, but the worker keeps computing because no cancel message is sent. When the worker eventually posts its result, handleMessage drops it (if (!entry) return), so segment hashes are never updated and the same segments can keep timing out/retrying without ever producing accepted results. This regresses behavior for large/slow documents; either propagate cancellation to the worker or avoid rejecting until the worker run is actually stopped.
Useful? React with 👍 / 👎.
| pending.delete(requestId); | ||
| cleanup(); | ||
| reject(createAbortError()); | ||
| }; |
There was a problem hiding this comment.
when a check takes longer than 10s, ProofingSessionManager gives up and the provider rejects — but nothing tells the worker to stop. the worker keeps running, eventually replies, and the reply gets thrown away here. next cycle, the same segments come back through and get sent to the worker again. i hit this in the browser against superdoc@next — same segmentId posted twice in a row, worker still busy from the first one. that's the same "spellcheck never settles" feel the PR is trying to fix, just via timeouts now instead of a blocked main thread. fix is to post a cancel message to the worker so it stops early.
Issue
./typoWorkerMessages,./typoWorker).Proposed solution