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

bug: Client-side error with formAssociated web component generated with @stencil/react-output-target in Next.js leads to: Uncaught RangeError: Maximum call stack size exceeded #6038

Closed
3 tasks done
baumgm94 opened this issue Oct 31, 2024 · 5 comments
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@baumgm94
Copy link

Prerequisites

Stencil Version

4.22.2

Current Behavior

Using a Stencil Web Component (the formAssociated flag set to true) wrapped by @stencil/react-output-target within a form in a Next.js App, leads to an client-side error Uncaught RangeError: Maximum call stack size exceeded

Expected Behavior

The Stencil web component, generated as a React component via @stencil/react-output-target and used within an HTML form in a Next.js application, should function without errors. Specifically, setting formAssociated: true on the component should not result in any client-side errors, and no Uncaught RangeError: Maximum call stack size exceeded error should be thrown.

System Info

No response

Steps to Reproduce

  1. Clone Repository
  2. Install dependencies: npm ci
  3. Build web-components: npm run build:web-components
  4. Start development server: npm run dev:app
  5. Open browser: http://localhost:3000
  6. Open dev-tools and reload page, you should see: Uncaught RangeError: Maximum call stack size exceeded

Code Reproduction URL

https://github.com/baumgm94/nextjs-stenciljs-example

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Oct 31, 2024
@matheusviriato
Copy link

This error unfortunately happens to me. I'm trying to use components with formAssociated in a vite+react SPA application and I'm having the same error. I've used my component with and without the @AttachInternals() decorator and the error still persists. It only stops when I remove the formAssociated property :(

It seems that the error is in this internal function getHostRef. I don't know if in the generation of dist-custom-elements there is some reference loop because of the element internals...

@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Nov 7, 2024
@christian-bromann
Copy link
Member

@baumgm94 thanks for reporting and providing a reproducible example. Our team is working on a lot of competing efforts and can't take a look at this immediately. Any contributions are welcome.

@dwirz
Copy link
Contributor

dwirz commented Nov 13, 2024

Hello @christian-bromann,

I’ve opened a PR to address the issue which is discussed here. Could you, or someone from the Ionic team, take a quick look at it? Resolving this would mean a lot to us, as it’s currently a blocker for our customer’s component library.

Thanks in advance, and a big thank you to the team for the fantastic work on Stencil! 🤗

@baumgm94
Copy link
Author

Thanks to everyone who contributed to this PR—it’s greatly appreciated!

@christian-bromann, does your team already have a planned date for the next release?

@christian-bromann
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

4 participants