Convenient wrappers for @particles/filters
.
Installation
yarn add -E @procore/labs-filters
import { Filters, FiltersContainer } from '@procore/labs-filters';
Motivation
While integrating @particles/filters
in Procore, it was found to have several design and implementation issues that needed to be addressed, which resulted in code duplication within the micro-frontend architecture.
labs-filters
main goal is to eliminate code duplication within the app, but it also addresses other issues of @particles/filters
, such as:
-
@particles/filters
implicitly provides controlled and uncontrolled ways of using it, which violates interface segregation principle -
onChange
method is only provided with an unordered list of selected filters, making persistance of selected filters a problem -
onChange
is overloaded with unnecessary concerns, such as handling "filter unfocused" events - Filters are not displayed in the correct order when used via controlled API