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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dwirz
Copy link

@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
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.

1 participant