diff --git a/packages/web/components/earn/filters/filter-context.tsx b/packages/web/components/earn/filters/filter-context.tsx index a10cdab92e..5fcdc351af 100644 --- a/packages/web/components/earn/filters/filter-context.tsx +++ b/packages/web/components/earn/filters/filter-context.tsx @@ -79,6 +79,13 @@ export const FilterProvider = ({ return setFilters((prev) => { const prevArray = prev[key] as ListOption[]; + /** + * This code chooses what new array + * to return based on the existence of the incoming filter value. + * + * If the incoming value is already present in the state value, + * then remove it. If it doesn't, then add it. + */ const newArray = exists ? prevArray.filter( (prevOption) => prevOption.value !== filterValue.value