Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Create overlapping filter options #82

@pauljickling

Description

@pauljickling

Current behavior:

A user clicks on a filter option (e.g. Day 1), and the video list updates with videos that match that criteria. A user then clicks on a different type of filter option (e.g. Breakroom), and then the video list updates with videos that match the new criteria.

Desired behavior:

When a user selects a different category of filter option, it does not remove the currently applied filter.

Reason for current behavior:

In the initial filter implementation, a single piece of state is used, filteredVideos, which is initially set to the variable data (an array of objects with video data) from the pageContext object that is used to dynamically generate video pages. When the applyFilter function is triggered when a user clicks on a filter option, it loops through the data array, and pushes objects to the filteredData variable that match the filter criteria. The filteredVideos state is then updated with the filteredData array.

Solution to achieve desired behavior:

  1. Track additional state. When applying a filter it should be known whether a particular filter type has been applied, and whether that filter type's filter results need to be updated.
  2. Have the filter function loop through the filteredVideos state rather than the data variable from which it derives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions