community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

🐛 Bazaar: Entity List Not Passed Through React Components

Open toriannwin opened this issue 10 months ago • 3 comments

Workspace

bazaar

📜 Description

We have a custom Bazaar View page where we render the ProjectPreview component and pass in a list of catalog entities which we want to fetch with our own function instead of using Bazaar's fetchCatalogItems. (The reason for this is that we want to exclude Resources and only allow Components to be linked)

However the Link Entity functionality list of entities doesn't reflect these entities that we've passed through.

When looking through the codebase it seems like the problem is:

ProjectCard passes in only the first item from the list of entities into HomePageBazaarInfoCard and the HomePageBazaarInfoCard is pulling all of the catalog entities again at this point.

👍 Expected behavior

Ideally the full list would be passed in so that when LinkProjectDialog is rendered, it gets the same catalogEntities as was originally passed in to ProjectPreview. Then our custom page for showing our custom Bazaar projects would use our custom list of entities when we select "Link Entity" for a specific project.

👎 Actual Behavior with Screenshots

The Link Entity popup that comes up shows all Components and Resources even when we originally passed a list of just Components into the ProjectPreview.

👟 Reproduction steps

  1. Render ProjectPreview by passing in a custom list of entities (in my case, Components only)
  2. Once rendered, select a Project and select Link Entity
  3. See that the list of entities includes all Components and Resources

📃 Provide the context for the Bug.

Our Bazaar use case is customized to support Innersource project collaboration. We want these projects to be linked to Gitlab repositories only, which are Components in our Catalog.

This actually came up because not all Components are showing up in the list when selecting Link Entity if there are a lot of Resources and Components (possibly a pagination issue) and when looking at that we realized that we don't want to show all of the Resources so I was working to limit it to Components when I found this bug. (The list of entities getting cut off is possibly a pagination issue with fetchCatalogItems also...?)

👀 Have you spent some time to check if this bug has been raised before?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

toriannwin avatar Apr 30 '25 20:04 toriannwin

@awanlin would you mind taking a look at this when you have a sec? 🙏

billabongrob avatar May 06 '25 15:05 billabongrob

Thanks for pointing this out, @toriannwin 🙏.
Yeah, it looks like some refactoring is needed. Perhaps we can make sure adopters can pass an optional filter to filter out the entities, so that you don't have to fork the Bazaar view page.
Regarding the pagination issue, looking at the code, it might be that the bug is here. The implementation of fetchCatalogItems looks correct, even if it's not recommended to fetch entities this way. Otherwise, you might end up fetching a lot of data depending on how big your catalog is.

~Would you like to be assigned to the issue? We're happy to assist you in finding the best way to tackle this.~ looool I totally missed your PR, thx! 🚀

vinzscam avatar May 07 '25 11:05 vinzscam

@vinzscam thank you for the feedback! I'll look at your notes on the PR as soon as I can! I did consider that passing an optional filter may be a good idea, I can see about updating my PR for that!

toriannwin avatar May 07 '25 15:05 toriannwin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 06 '25 18:07 github-actions[bot]