atanasster / storybook-addon-deps

A storybook addon to add a dependencies tree exporer tab.

Home Page:https://atanasster.github.io/storybook-addon-deps/?path=/docs/design-system-avatarlist--short

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kkckkc opened this issue · comments

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

Merged and released your fix, thanks a lot