Repository navigation
mixin_markdown_widget: let MixinSelectionArea settle with MarkdownWidget - #552
Merged
boyan01 merged 1 commit intoOct 21, 2026
Conversation
MarkdownDocumentView notified its selection registrar on every didUpdateWidget. Each registrar refresh bumps the document version, which rebuilds MarkdownWidget and the document view, so the refresh rescheduled itself every frame and pumpAndSettle never completed. Notify the registrar only when the rendered document actually changes.
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.
Summary
MixinSelectionArea+MarkdownWidgetnever stopped scheduling frames, sopumpAndSettletimed out. Every registrar refresh rebuilt the document view, and the document view always asked for another refresh:MixinSelectionArea._refreshDocument ++documentVersion, setState MixinSelectionRegistrar.updateShouldNotify -> true MarkdownWidget (depends on registrar) rebuilds MarkdownDocumentView.didUpdateWidget - participantChanged(this) // every time + if document is not identical: + participantChanged(this) _scheduleDocumentRefresh -> next frame -> _refreshDocument ...The participant's
blockscallback reads the currentwidget.document, so the registrar only needs to rebuild when the document changes.MixinSelectablealready notifies only on real changes.The
MixinSelectionAreatest inmarkdown_context_menu_test.dart(#551) worked around this withsettle: false. It now usespumpAndSettle, and the workaround parameter is gone.Evidence
New test
MixinSelectionArea with MarkdownWidget settles:pumpAndSettle timed outAfter: passes. The second half checks that real document changes still reach the registrar.
flutter test(281 passed) andflutter analyze(no issues) frompackages/mixin_markdown_widget.Merge Danger
Door: two-way
Blast Radius: small
Only
MarkdownDocumentViewinside aMixinSelectionAreais affected. A host that swapsMarkdownDocumentViewarguments other thandocument(theme,selectable, controller) no longer triggers a registrar refresh by itself; registration and unregistration still go through_syncSelectionParticipant.