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: correctly call proxied formAssociated callbacks #6046

Merged

Conversation

dwirz
Copy link
Contributor

@dwirz dwirz commented Nov 11, 2024

Current Behavior

The proxyComponent function currently overwrites the formAssociatedCallback and all other formAssociated-callback methods on the component’s prototype, causing this.formAssociatedCallback to reference the proxy wrapper instead of the original method. This results in infinite recursion when the method attempts to call itself.

Note: This bug only occurs when the externalRuntime flag for the dist-custom-elements output target is set to false. In this configuration, the generated code does not use $lazyInstance$[cbName] (which correctly references the original method) but instead relies on this[cbName], which causes the method to recursively call itself, leading to an infinite loop.

GitHub Issue: #6038

New Behavior

These changes ensure that formAssociatedCallback and all other FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS are properly referenced and called, preventing infinite recursion. When the lazyLoad flag is enabled, the method on the $lazyInstance$ is used. Otherwise, the original method is called directly, avoiding the infinite loop.

Documentation

No significant documentation changes are required.

Breaking Change?

  • Yes
  • No

Testing

A new test has been added in test/wdio to verify this behavior.

Additional Information

None.

@dwirz dwirz requested a review from a team as a code owner November 11, 2024 19:45
@baumgm94
Copy link

baumgm94 commented Nov 20, 2024

Hi @christian-bromann, just checking in to see if there are any updates on this PR. Let me know if there's anything needed from my side to help move it forward!

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pinging and putting up this great pull request. The code looks good to me, will merge once all test pass.

👍

@christian-bromann christian-bromann added this pull request to the merge queue Nov 20, 2024
Merged via the queue into ionic-team:main with commit dffb49d Nov 20, 2024
88 checks passed
@baumgm94
Copy link

@christian-bromann, Thank you very much! Your effort is highly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants