Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(overlays): trigger is configured on load #28526

Merged
merged 3 commits into from Nov 29, 2023
Merged

fix(overlays): trigger is configured on load #28526

merged 3 commits into from Nov 29, 2023

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Nov 14, 2023

Issue number: resolves #28524


What is the current behavior?

Watchers in Stencil are constructed sometime between connectedCallback and componentDidLoad. If a property is set/changed during that time it is possible for the callback associated with the watcher to not fire because the watcher has not been setup yet. This is most often with dist-custom-elements and frameworks such as Angular when using a binding (i.e. [trigger] instead of trigger)

What is the new behavior?

  • The trigger callback associated with the watcher is manually called in componentDidLoad for each overlay.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 7.5.5-dev.11699974376.13a15397

Note: This is a timing related bug due to a behavior in Stencil, so I did not write automated tests. However, I manually verified that this issue a) reproduces on main and b) is fixed with this dev build for each overlay component.

@github-actions github-actions bot added the package: core @ionic/core package label Nov 14, 2023
@liamdebeasi liamdebeasi marked this pull request as ready for review November 14, 2023 15:56
@liamdebeasi liamdebeasi requested review from a team and sean-perkins and removed request for a team November 14, 2023 16:58
@liamdebeasi liamdebeasi requested a review from a team November 29, 2023 18:15
@liamdebeasi liamdebeasi added this pull request to the merge queue Nov 29, 2023
Merged via the queue into main with commit a3cd204 Nov 29, 2023
56 checks passed
@liamdebeasi liamdebeasi deleted the FW-5590 branch November 29, 2023 22:04
github-merge-queue bot pushed a commit that referenced this pull request Jan 17, 2024
Issue number: resolves #28816

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

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, our `value` property watcher does not fire
which causes `ionSelect` 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?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Segment now emits `ionSelect` on `componentDidLoad` so that any
descendant segment buttons can update correctly.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: component trigger not working for async ngfor
2 participants