-
Notifications
You must be signed in to change notification settings - Fork 118
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
bug: proxyInputs errors when called multiple times #397
Labels
Comments
This was referenced Oct 26, 2023
liamdebeasi
added a commit
that referenced
this issue
Oct 26, 2023
github-merge-queue bot
pushed a commit
to ionic-team/ionic-framework
that referenced
this issue
Oct 27, 2023
…re used (#28423) Issue number: resolves #28418 --------- <!-- 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. --> Due to ionic-team/stencil-ds-output-targets#397, calling `proxyInputs` for the form controls caused an error to be logged in developer applications. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Updated to a version of the Angular output targets with a patch for this error - I also excluded the `utils.ts` from all `angular-component-lib` directories from prettier since it was causing a diff. These changes are autogenerated so we should not be linting them anyways. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## 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.5.3-dev.11698340692.18daff2f`
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the output targets, please create a new issue and ensure the template is fully filled out. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Prerequisites
Stencil Version
4.6.0
Stencil Framework Output Target
Angular
Stencil Framework Output Target Version
0.8.2
Current Behavior
When calling
proxyInputs
multiple times anCannot redefine property
error is thrown in Chromium-based browsers. (Other browsers still throw an error, but the exact error message is slightly different). This is happening due to our usage ofObject.defineProperty
:stencil-ds-output-targets/packages/angular-output-target/angular-component-lib/utils.ts
Line 8 in 0c58ea1
These properties are non-configurable by default, so attempting to change them will result in an error: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
This is not a problem when using the
ProxyCmp
decorator sinceproxyInputs
will be called at most once. However, callingproxyInputs
inngOnInit
will result in the error if that component is used more than once on a page.Ionic Framework needs to call
proxyInputs
inngOnInit
instead of using theProxyCmp
decorator to work around an ng-packagr/Webpack bug. Using a provider that references the Angular class in addition to two or more decorators causes the compiled component to be re-assigned. This re-assignment breaks treeshaking and causes components to be bundled even if they are not being used in the app.See ionic-team/ionic-framework#28359 for more information.
Expected Behavior
I expect
proxyInputs
to be idempotent. Calling it multiple times should not have a different effect than calling it once.Steps to Reproduce
npm install
.npm run start
and open application in browser (typically served on port 4200). You can reproduce this on a non-Chromium browser but just be aware that the exact error message may be worded slightly different.Code Reproduction URL
https://github.com/dtarnawsky/cs-752
Additional Information
No response
The text was updated successfully, but these errors were encountered: