Component with grid breaks row hug/fill when removing certain cells in a placed instance
I have been working on expanding our design system in template components such as grid templates which hold slots inside each cell. The idea is the grid components get built once and the slots can hold certain scoped composition components (for example: a content card, tiles, images, etc.)
When copying the grid component in its own instance everything works perfect as long as the cell amount is maintained of the master’s setup (for example 10 cells divided between 2 row and 5 columns.)
...however when the instance only needs 2 of the 10 and I want to hide the other 8, the grid breaks. The grid’s row hug/fill property is automatically set back to fill, components collapse, etc. When unhiding the others, it jumps back into position.
Steps to reproduce my setup:
- Create a primitive “_cell” which holds a content slot
- Create a grid component with some layout (for example 5x2) and fill each cell with the ‘_cell’ primitive
- Set up the grid so the columns fill with 1fr, and height is hugging content inside
- Set up the _cells the same way so they also fill the column width, but hug inner content height
- Create some card component which will be used to fill the slot
- Create an instance of the grid and will the cells with the card component
Check: should look good
- Now remove 2 rows (maybe change some content on the cards as if you’re really defining a design)
Check: Should auto switch the height from hug to fill and layout should start breaking.
