Selecting date clears other facet values when using AJAX

Created on 2 April 2022, about 2 years ago
Updated 28 September 2023, 9 months ago

Problem/Motivation

The Date Range facet doesn't work correctly with other facets on the page if the view of search results has AJAX enabled. When you select a date in the Date Range facet, it deselects any other facets that were previously selected.

Steps to reproduce

  • Basic setup:
    • Set up a fresh Drupal 9 site with facets_date_range enabled.
    • Set up a content type with a date field and a boolean field.
    • Create a few nodes with different field values.
    • Set up a database search server, search index, and view of the search index with a page display.
    • Set up a Date Range facet for the date field and a checkbox facet for the boolean field.
    • Add the facet blocks to the search page.
  • Key steps to reproduce the bug:
    • In the view of the search index, set Advanced > Other > Use AJAX to Yes.
    • On the search page, check the "On" box for the boolean facet.
      • After the AJAX reload, the "On" checkbox remains checked (good).
    • Select a min date for the date range facet that will not further narrow the search results.
      • After the AJAX reload, the min date's form field contains the selected date (good) — but the "On" checkbox is now unchecked and the displayed search results are no longer narrowed to "On" values (bad).

Proposed resolution

The way that DateRangeWidget passes the facet result's URL to the JavaScript code doesn't work with AJAX. I think we need to use an AJAX SettingsCommand.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇸United States jlstrecker Athens, Ohio, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024