Announce whole-document replacements so spell check can re-run - #95
Draft
Wavesonics wants to merge 2 commits into
Draft
Announce whole-document replacements so spell check can re-run#95Wavesonics wants to merge 2 commits into
Wavesonics wants to merge 2 commits into
Conversation
setText replaces the document without emitting an edit operation, so nothing downstream could tell its text was gone. Spell check learned about a document only when the platform checker became available, which on Android beat the markdown import often enough that the one-shot check ran over an empty document and no squiggles ever appeared. The sample app worked around it with a second LaunchedEffect that re-ran the full check itself; any host loading content programmatically needed the same workaround, and HtmlExtension's import had none. TextEditorState now exposes documentReplacements, and SpellCheckingTextEditor runs a full check on it. Either race order costs one real scan: whichever of the checker and the document arrives last triggers the check, and the earlier one finds no words or no checker.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Wavesonics
marked this pull request as draft
August 7, 2026 06:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
setTextreplaces the document without emitting an edit operation, so nothing downstream can tell its text is gone. Spell check learned about a document only when the platform checker became available, which on Android beats the markdown import often enough that the one-shot check runs over an empty document and no squiggles ever appear.The sample app worked around this with a second
LaunchedEffect(spellChecker, markdownExtension)that re-ran the full check itself. Any host loading content programmatically needed the same workaround, andHtmlExtension's import had none.TextEditorStatenow exposesdocumentReplacements, emitted fromreplaceContent(whose only callers are the twosetTextoverloads), andSpellCheckingTextEditorruns a full check on it. The sample app's workaround is deleted.Either race order costs one real scan: whichever of the checker and the document arrives last triggers the check, and the earlier one finds either no words or no checker. That removes the duplicate concurrent full check at load without needing any serialization.
Notes
BasicTextEditorcallssetTextwhen itstextparameter changes, so a host driving text from state now gets a full re-check on each change. That is the intended behavior, but it is a behavior change rather than a pure cleanup.A separate signal rather than a synthetic edit operation: emitting a real operation would be arguably more correct but ripples into undo/redo and every existing
editOperationscollector.This is independent of #94, which stays drafted.
Tests
DocumentReplacementSignalTestcovers the signal itself (setTextemits, an edit does not). Two cases inSpellCheckE2eTestcover the behavior through the real editor stack: a document loaded into a composed editor gets checked, and replacing a document checks the new text. Both fail with the collector reverted; verified.