Problem/Motivation

In the Entity Mesh view, the exposed filter select options are built dynamically from the current results shown in the table. This causes a stability issue.

If a value that was previously available in the system (and can still be referenced by a saved filter, URL parameter, or bookmarked view) later disappears from the current dataset, the exposed filter no longer contains that option. When the view is requested with that missing value, Views throws an error instead of returning an empty result set or a validation message.

Example: the Schema filter (HTTP/HTTPS/etc.) should be available independently of what is currently returned in the table, because it represents a known set of valid values.

Steps to reproduce

  • Go to the Entity Mesh SME listing page (a Views table with exposed filters).
  • Confirm an exposed select filter is populated from current results (e.g., **Schema**).
  • Apply a filter value that exists (e.g., `schema=https`) and save/bookmark the filtered URL (or share it).
  • Change the data so that the chosen value no longer appears in the current dataset (e.g., remove/update all items with `schema=https`, or change the field values).
  • Load the previously saved/bookmarked URL that still contains the filter value.
  • Observe that the view returns an error (instead of showing zero results or handling the value gracefully).

Proposed resolution

Ensure exposed filter options are **not derived from the current result set** when the filter represents a known, valid domain of values. The view should accept previously valid filter values without throwing an error.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lpeidro created an issue. See original summary.

lpeidro’s picture

Issue summary: View changes
lpeidro’s picture

Issue summary: View changes

nickolaj made their first commit to this issue’s fork.

nickolaj’s picture

Status: Active » Needs review

Overrides `validate()` in `BaseSelectFilter` to strip out submitted exposed filter values that no longer exist in the database before calling the parent validation. This prevents the "illegal choice" error when a bookmarked URL contains a filter value whose matching data has since been removed — the view simply returns zero results instead.

lpeidro’s picture

Status: Needs review » Fixed

Hello @nickolaj, thank you for your contribution. I merge the branch.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • lpeidro committed a798521a on 2.x authored by nickolaj
    Issue #3576679: Overrides `validate()` in `BaseSelectFilter` to st...
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.