Open DavideMininni-Fincons opened 1 year ago
hey!
Just wondering if you've tried adding key
attributes to your lists?
https://stenciljs.com/docs/templating-jsx#dealing-with-children < the value of which must be unique (an iterator int won't cut it)
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.
Thank you for using Stencil!
Reopening - this shouldn't have been closed. Sorry about that!
Prerequisites
Stencil Version
3.3.0
Current Behavior
Hello guys :) I'm actually working on a breadcrumb-group component.
One of the requested feature is: when the breadcrumbs in the group exceed the container width, only the first and the last should be visibile, plus an ellipsis one between them.
To do this:
breadcrumb-0
,breadcrumb-1
etc within ali
;componentDidLoad
I do the width check and possibly set a State variable to true;breadcrumb-0
, the ellipsis 'fake' element, and the slot namedbreadcrumb-{last element in the list}
In the first render, everything works, so considering 4 elements, the html is something like this:
But when I re-render, after the State change, I have this in the shadow-root:
The last breadcrumb is the named
breadcrumb-2
, instead then the number 3.I did various tests and it seems that in the second render, the slot name prop is not 'recalculated', eg.
breadcrumb-{last element in the list}
, it still doesn't work;fake-ellipsis
element in the breadcrumb array using the splice method, adding it in 2nd position and removing all the items except from the first and the last, it still doesn't work;breadcrumb-1
disappears and in the last position I have two elements with the same slot name;foo
, it prints the slot after the number 2, so number 3, and it keeps the namebreadcrumb-3
instead thenfoo
.Expected Behavior
I expect that the last slot has the correct name, in order to have the right content in it.
System Info
Steps to Reproduce
Code Reproduction URL
https://github.com/DavideMininni-Fincons/stencil-demo-issues.git
Additional Information
Repo with the original breadcrumb issue: https://github.com/lyne-design-system/lyne-components/tree/feat/sbb-breadcrumb with temporary fix: https://github.com/lyne-design-system/lyne-components/commit/b85927766d25af523a2dcd45546db40249fd0ccc#diff-31f35f89d4cbf3dba3b49db0028c7fde7c391ad9700c239988330e5baee85f11R108