Repository navigation
fix(registry): stop theme scopes rebuilding on unrelated MediaQuery changes - #319
Open
leoafarias wants to merge 2 commits into
Open
leoafarias wants to merge 2 commits into
leoafarias wants to merge 2 commits into
Conversation
…hanges The Vanilla and Fortal theme scopes checked MediaQuery.maybeOf(context) to decide whether to supply a MediaQuery from the view. maybeOf subscribes to every MediaQuery field, so the scope and everything it builds rebuilt on unrelated changes such as keyboard insets, once per frame while the keyboard moves. Use getElementForInheritedWidgetOfExactType, which does not subscribe. System mode still follows platformBrightness through its own aspect lookup. Regenerates the registry templates and the installed copies in the workspace consumer apps.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The branch that supplies a MediaQuery when a scope sits above any had no test, because View always provides one in apps and widget tests. Pump each scope under a bare RawView and check it supplies a MediaQuery and follows the view's brightness. Also tell preset authors which lookup avoids the rebuild this PR fixes.
This was referenced Oct 27, 2026
This branch has not been deployed
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.
Description
VanillaThemeandFortalThemedecided whether to supply aMediaQueryfrom the view by callingMediaQuery.maybeOf(context). That call subscribes to everyMediaQueryfield, so the scope rebuilt on unrelated changes such as keyboard insets, once per frame while the keyboard animates. With Fortal the rebuild also reached every widget that reads a Fortal token, because its shadow tokens are fresh lists that never compare equal; with Vanilla it stayed within the scope and its own wrappers.The check now uses
context.getElementForInheritedWidgetOfExactType<MediaQuery>(), which finds the ancestor without subscribing. System mode still followsplatformBrightnessthrough its own aspect lookup. The registry templates and the installed copies in the workspace apps are regenerated, and the design-system skill now names this lookup for preset authors.Validation
viewInsetschange and exactly once on aplatformBrightnesschange in system mode, counted withdebugOnRebuildDirtyWidget. Both fail on the old line (Expected: 0, Actual: 1).RawView(noMediaQueryabove it) supplies one and follows the view's brightness. This branch had no coverage before; the test fails when the branch is disabled.registry_sourcesuite: passed.dart analyze: no issues.open-code:registry:build --checkclean;tool/check_consumer_apps.dart: all four consumer apps mirror the registry.dart formatcheck andmelos run ci:checks: passed.Related Issues
None.
Checklist
///).Breaking Change