teleporthq / teleport-code-generators

A collection of code generators for modern JavaScript applications
https://teleporthq.io
MIT License
1k stars 159 forks source link

fix: parent node to be of type fragment for slots #914

Open JayaKrishnaNamburu opened 2 months ago

JayaKrishnaNamburu commented 2 months ago

This PR, helps in converting the parentNode to of type Fragment when the prop is of type element. We do this only if the prop's defaultValue element is of type fragment. This is to make sure, we are not converting the element type for named-slot. We do have a prop of type element which we are using for named-slot. Here is a reference https://github.com/teleporthq/teleport-code-generators/blob/development/examples/uidl-samples/project.json#L6726

If we don't follow the convention, we will be changing the structure of the layout. So, when you want this behaviour to kick-in. Always pass the root node of defaultValue of the prop to start with fragment.