Skip to content

GenericFilter: activating a configuration in onInit breaks subsequent configuration switching #5400

Description

@fractal3000

Description

A GenericFilter preserves the data loader's own condition and combines it with the active
configuration. If a configuration is made current during the view's onInit, that own condition
is recorded incorrectly — it already includes the activated configuration. Switching to another
configuration afterwards then combines both configurations instead of replacing, so the loader gets a
contradictory condition and the grid usually comes back empty.

This happens with the plain base API (GenericFilter.setCurrentConfiguration(...) in onInit) and
with the new builder's makeCurrent(); a standalone GroupFilter is affected the same way. It is a
regression from jmix#2406 and was surfaced by jmix#5351, but it is independent of that API.
Declarative default="true" configurations are not affected.

Reproduction

A list view with a GenericFilter and two configurations on the same attribute (e.g. status =
OPEN / status = CLOSED). In onInit, make the first one current
(setCurrentConfiguration(...)). Open the view, then switch the filter to the second configuration.

  • Expected: the grid shows rows of the second configuration.
  • Actual: the grid is empty; the loader condition is status = OPEN AND status = CLOSED.

Impact

Any view that activates a filter configuration programmatically in onInit (directly or via the
builder) shows wrong/empty data after the user switches configurations — a silent data-correctness
issue in a core, widely-used component.

Expected behavior

Activating a configuration in onInit must not affect later switching: switching always applies only
the target configuration's condition (on top of the loader's own condition). The filtered result on
open must also be correct.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

Status
Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions