The main difference here is that the courses dropdown starts with the "active" course (the one represented in the URL) pre-selected. Then, selecting a different course does not apply a filter to the activity table, as we are implicitly filtering by a single course. Instead, once a different course is selected, we navigate to that course and propagate the rest of the filters there.
To do/discuss
[ ] The courses dropdown behavior which "navigates" instead of "filter", presents a few cases that we need to discuss.
What to do when "All courses" is selected. We could navigate to the home page in that case.
What to do when the active course is clicked. The default multi-select behavior would be to de-select that course, which in this case is the same as selecting "all courses", so perhaps we could also navigate to the home page.
[x] Selects manage references to objects in order to determine what options are selected. In this case we are passing a course object which deep-equals one from the list, but is a different reference, so it is not marked as selected. We could:
~Refactor Select component to do deep-equal checks in order to determine if an option is selected.~
Slightly change the local logic so that we handle a list of IDs instead of a list of objects, which would require separately tracking the corresponding names. -> We are doing this as part of https://github.com/hypothesis/lms/pull/6466
[x] Implement logic to initialize filters based on query parameters, so that we can navigate to other places and propagate filters. -> Being implemented in https://github.com/hypothesis/lms/pull/6466
Continuing with the work from https://github.com/hypothesis/lms/pull/6453, this PR adds filters to the course section.
The main difference here is that the courses dropdown starts with the "active" course (the one represented in the URL) pre-selected. Then, selecting a different course does not apply a filter to the activity table, as we are implicitly filtering by a single course. Instead, once a different course is selected, we navigate to that course and propagate the rest of the filters there.
To do/discuss
Select
component to do deep-equal checks in order to determine if an option is selected.~