teambit / bit

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

fix(component drawer/filters): correctly derive env filter state when other filter state changes #9302

Closed luvkapur closed 1 week ago

luvkapur commented 1 week ago

This PR fixes the issue with the envs filter where it would incorrectly filter out results when other filter (like deprecation filter) state changes.

Previously, the envs filter would get populated initially with all non deprecated components, which results in it missing the env of the deprecated component, if no other non deprecated component has the same env.

Since the deprecation filter runs first (order in which the filter gets registered to the slot) - it only shows what already has been filtered out by the envs filter in this case it is the deprecated component since its env wasnt populated yet.

There are two fixes to address this issue,

  1. Now in the env's filter match function if all the envs are set to be true (checked) we dont run the filter and instead match everything. This handles the case when the envs filter state hasnt been populated with the env of the deprecated filter.
  2. During the rendering of the envs filter, we now correctly watch changes to the other envs state when deriving the list of envs to render. This handles the case where the env of the deprecated component won't show up in the envs multi select even when the deprecation filter is turned on.

https://github.com/user-attachments/assets/1c6a032c-5776-421f-a098-61cc1c301f8c