fix(core): reset inherited children when an InheritedProperty is unset - #11413
Draft
edusperoni wants to merge 1 commit into
Draft
edusperoni wants to merge 1 commit into
edusperoni wants to merge 1 commit into
Conversation
The reset branch of the cascade called the setter factory `setFunc` instead of a setter, so it built a new function and never wrote to the child. Descendants that had inherited the old value kept it after the source was reset to its default.
|
View your CI Pipeline Execution ↗ for commit d5edbb4
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
5 tasks
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.
PR Checklist
What is the current behavior?
When an
InheritedProperty(in core:bindingContext,iosOverflowSafeAreaEnabled,iosIgnoreSafeArea) is reset to its default on a node (unsetValueor'initial'), descendants that had inherited the old value keep it. The cascade's reset branch inui/core/properties/index.tscallssetFunc.call(child, unsetValue), butsetFuncis the setter factory(valueSource) => function(value), so the call only builds and discards a setter and never writes to the child.In practice this is reached through
clearInheritedProperties()when a subtree is detached (ViewBase._parentChanged) and throughBinding.updateTargetwhen abindingContextbinding resolves tonull/undefined.InheritedCssPropertyhas the correct pattern (setDefaultFunc.call(childStyle, unsetValue)).What is the new behavior?
The reset branch calls the concrete inherited setter (
setInheritedValue.call(child, unsetValue)). Because the child's parent has just becomeValueSource.Default, the child resolves todefaultValuewithValueSource.Default, fires its<name>Changeevent, and cascades to its own children. Children holding a local value are untouched, as before.Side effect worth noting for reviewers: detaching a subtree now clears inherited view properties on all descendants (not just the removed root) and emits
bindingContextChangeon them during teardown. This matches what inherited CSS properties have always done; re-attaching re-propagates viapropagateInheritableProperties. ListView item views receivebindingContextas a local value and are not affected.Tests:
ui/core/properties/inherited-property.spec.ts(6 cases: propagation,unsetValuereset,'initial'reset, local descendant untouched, re-propagation after reset, end-to-endbindingContextreset onStackLayout/Label). Three of them fail without the fix.Found while working on the property-change
originchange (#11412).