atanasster / storybook-addon-deps

A storybook addon to add a dependencies tree exporer tab.
https://atanasster.github.io/storybook-addon-deps/?path=/docs/design-system-avatarlist--short
MIT License
59 stars 3 forks source link

Arbitrary component selected as dependency in case multiple components of the same name #13

Closed kkckkc closed 3 years ago

kkckkc commented 3 years ago

In case you have multiple components with the same name, the add-on chooses the first matching component by name.

Example:

I have two components named Cart - one being an icon and one being a large part of a shopping cart page. The dependencies looks like

Navigation -> Cart (the icon)
ShoppingCartPage -> Cart (the shopping cart line item component)

When I look at dependencies for the ShoppingCartPage component, I see a dependency (incorrectly) to the Cart icon component.

The issue is in the findComponentDependencies function that uses find to find the first component named Cart, instead of finding all and then figuring out which one to use

atanasster commented 3 years ago

Merged and released your fix, thanks a lot