teambit / bit

A build system for development of composable software.
https://bit.dev
Other
17.82k stars 924 forks source link

fix(docs): gracefully handle missing compositions #9093

Closed luvkapur closed 1 month ago

luvkapur commented 1 month ago

This PR updates the docs preview runtime by gracefully handling missing compositions. When the onlyOverview param is true, compositions in the docs iframe are mounted from the client side - which results in the docs preview runtime receiving an empty array of compositions. Before this fix, the docs preview runtime would just try to extract the first element from the compositions array and forward it to the mounters - which resulted them in receiving it as undefined during runtime (even though the docs props indicated that the compositions prop is not optional)

With this fix, we fallback to an empty array when there are missing compositions so the mounters don't get undefined for compositions prop.