fix(segment): setting value via binding updates button state #28837
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.
Issue number: resolves #28816
What is the current behavior?
The value is set on Segment asynchronously when binding it in Angular. However, the timing works out such that the value changes after
connectedCallback
is fired but before any Stencil Watchers are configured. As a result, ourvalue
property watcher does not fire which causesionSelect
to not be emitted. Segment Buttons rely on this event to know when to update their state (if the value changes such that a segment button is now selected). This results in a checked segment button not appearing checked.This is similar to other issues that have been fixed:
#28510
#28488
#28526
What is the new behavior?
ionSelect
oncomponentDidLoad
so that any descendant segment buttons can update correctly.Does this introduce a breaking change?
Other information
Dev build:
7.6.5-dev.11705415448.16878103
This is a timing issue with Stencil, so I am unable to write a reliable automated test. Reviewers should test the dev build in the repro provided in the linked issue.