Refactor filters into its own service #249
Labels
aspect-CodeQuality
aspect-Scalability
category.Chore
a task that needs to be done
difficulty.Moderate
can be done after you have done a few easy issues first
s.ToDiscuss
Is your feature request related to a problem? Please describe.
It is frustrating that the filters are declared in multiple components and observables are prop drilled into other components in order to make things work. As a developer working on the filters, it is very difficult to follow.
For example, labelFilter BehaviourSubject is delared in filter-bar, and prop drilled into label-filter-bar.
label-filter-bar is then the component that initializes the labels, calling .next on the behaviour subject from filter-bar.
Additionally, certain filters are referenced objects such as labels being an array and hidden labels being a set. We also use a DEFAULT_DROPDOWN_FILTER variable as the base for when filters are reset.
Because of these referenced filters, an easy mistake for developers would be these objects' mutation by components, resulting in a permanent mutation of the base DEFAULT_DROPDOWN_FILTER.
This follows from the solution for #205, intended to be worked on after that PR, #226, is merged in.
Describe the solution you'd like
A new service filters.service.ts that contains the current repo filters stored as observables and subscribed to the relevant github services such as labelService subscription.
Filters are encapsulated within this component.
Components use the observable's .next and .subscribe functions to access and modify filters
Describe alternatives you've considered
We can leave the filters as is and risk errors down the line due to the issues mentioned.
We can use a context provider to lift the state out instead of using a filters service.
The text was updated successfully, but these errors were encountered: