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

node.parentNode value is null when relocating slot content in certain cases #2758

Closed
kensodemann opened this issue Dec 3, 2020 · 5 comments · Fixed by #2761
Closed

node.parentNode value is null when relocating slot content in certain cases #2758

kensodemann opened this issue Dec 3, 2020 · 5 comments · Fixed by #2761

Comments

@kensodemann
Copy link
Member

kensodemann commented Dec 3, 2020

Stencil version:

 @stencil/[email protected]<version>

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
Working with a community member we've run into this strange error that shows up when we bring in a Stencil component (scoped w/ slots) in an app using maquette (https://maquettejs.org/):

index-91ef63aa.js:1059 Uncaught (in promise) TypeError: Cannot read property 'childNodes' of null 
at relocateSlotContent (index-91ef63aa.js:1059) 
at relocateSlotContent (index-91ef63aa.js:1109) 
at renderVdom (index-91ef63aa.js:1179) 
at updateComponent (index-91ef63aa.js:1348) 
at index-91ef63aa.js:1324 
at then (index-91ef63aa.js:1547) 
at dispatchHooks (index-91ef63aa.js:1324) 
at Array.dispatch (index-91ef63aa.js:1292) 
at consume (index-91ef63aa.js:2747) 
at flush (index-91ef63aa.js:2800)

The error seems to be caused by a comment node being processed when relocating the slot content.

Expected behavior:
It would not throw an exception... :)

Steps to reproduce:

  1. clone https://github.com/Esri/calcite-components/
  2. check out the 1121/radio-mapviewer-issues branch.
  3. run npm i && npm start
  4. open <dev server url>/demos/maquette-playground.html (make sure dev console is open)

Other information:
Additional info:

  • calcite-radio-button (used in the repro case)
  • the following build flags are enabled:
extras: { 
  appendChildSlotFix: true, 
  cssVarsShim: true, 
  dynamicImportShim: true, 
  safari10: true, 
  scriptDataOpts: true, 
  shadowDomShim: true, 
  slotChildNodesFix: true 
}
@ionitron-bot ionitron-bot bot added the triage label Dec 3, 2020
@kensodemann
Copy link
Member Author

kensodemann commented Dec 3, 2020

Using the sample is the repo provided by the Stencil user, the issue appears to manifest on this line of code with the content of the childNode being <!---->.

More info from the user:

the error occurs whenever there is a single text node. The following maquette snippet will produce the error:

h("calcite-radio-button", ["foo"])

Adding more than one works fine:

h("calcite-radio-button", ["foo", "bar"])

@claviska claviska added bug and removed triage labels Dec 3, 2020
@eriklharper
Copy link

eriklharper commented Dec 3, 2020

Hi @kensodemann! I discovered and reproduced this bug originally. Let me know if you/the team have any questions when you start to take a look at this.

@eriklharper
Copy link

eriklharper commented Dec 3, 2020

I reproduced this bug here with stencil-component-starter: https://github.com/eriklharper/stencil-maquette-bug. Just clone that, npm i && npm start to see the bug. Ignore the steps to reproduce up above since the maquette playground html file has been removed from that branch.

@eriklharper
Copy link

eriklharper commented Dec 3, 2020

I can't seem to get my local build of Stencil working with the 1121/radio-mapviewer-issues branch. I'm getting lots of TypeScript errors that don't occur when using the npm build of Stencil (same versions and everything).

@eriklharper are you able to provide a more reduced test case so I can test against this problem locally?

#2758 (comment)
https://github.com/eriklharper/stencil-maquette-bug

@claviska
Copy link
Contributor

claviska commented Dec 3, 2020

@eriklharper Just saw that after posting my comment...thanks, I'll take another look!

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 a pull request may close this issue.

3 participants