Refactor URL Processor to better integrate with facets.

Created on 24 June 2024, 6 days ago

Problem/Motivation

Currently the core views facets module's URL processor does most of the heavy lifting for the 'active' state in the setActiveItems function. The problem is that's late in the processor life cycle, which causes functions like getActiveFilters to be empty due to the 'active' state not having been calculated yet. Some of the facet model's functionality, like the reset link, depend on that function in order to work correctly.

Steps to reproduce

  1. Setup a facet with core views facets URL Processor and choose the Link widget.
  2. Enable the reset functionality.
  3. Load the view and examine the URLs of the links. The 'reset' link will still have the active filter parameter included, rendering it useless.

Proposed resolution

Modeled after the QueryString url processor, I moved the active state logic to occur in the processor's constructor. I then modified it to store the information in the activeFilters array, which the getActiveFilters and setActiveItems functions depend on. I also overwrote the getFilterKey function to return the view's URL parameter, which is also needed for the reset functionality to work. After making these changes, the reset link appears to work correctly for me.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jacobbell84

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024