Skip to content

GenericFilter: restoring filter state from the URL fires a redundant data load when a condition operation differs - #5659

Open
fractal3000 wants to merge 1 commit into
bug/5516-one-condition-is-shown-but-another-is-applied-in-generic-filterfrom
bug/5655-redundant-load-on-url-restore-operation-change
Open

fractal3000 wants to merge 1 commit into
bug/5516-one-condition-is-shown-but-another-is-applied-in-generic-filterfrom
bug/5655-redundant-load-on-url-restore-operation-change

Conversation

@fractal3000

Copy link
Copy Markdown
Contributor

See #5655

Stacked on #5634 (base branch = its branch; GitHub will retarget this PR to release_3_0 when #5634 merges). Only the last commit belongs to this PR.

Restoring the filter state from URL query parameters fires a redundant intermediate data load. Reproduction (Scenario 27 of the filter-test project attached to #5655): a configuration with an editable-operation condition, the user changes the operation (=<>), then reloads the page or opens the bookmarked link — two data loads instead of one, the first by a half-restored state and discarded. For a 400 ms query a deep-link open pays roughly double.

Cause: GenericFilterUrlQueryParametersBinder.updatePropertyCondition applies the operation from the URL programmatically, and the operation-change listener registered by GroupFilter.add invoked apply() — and thus dataLoader.load() — for a programmatic setOperation as well, unlike the value path, which has always been gated by isFromClient.

Fix: the listener applies the filter on a client-driven change only. A programmatic setOperation no longer fires a load of its own — consistent with a programmatic setValue, which never did.

Tests: GenericFilterUrlRestoreLoadTest — a restore with a changed operation fires no load (fails without the fix); the tests that used the automatic load as an instrument (GenericFilterReNavigationTest, GenericFilterApplyAfterBaseChangeTest) now emulate the client-driven gesture via setOperationInternal(op, true). Full facet.url_query_parameters.* and component.genericfilter.* pass on top of #5634.

Release note: an application that relied on a programmatic PropertyFilter.setOperation(...) reloading the data must call apply() or dataLoader.load() explicitly.

On master the same fix arrives with the forward-port of this PR (it was deliberately kept out of #5658).

🤖 Generated with Claude Code

Restoring the filter state from URL query parameters fired a redundant
intermediate data load: the binder applies the operation from the URL to the
configuration's condition programmatically, and the operation-change listener
that GroupFilter registers on its child conditions invoked apply() - and thus
a data load - for a programmatic setOperation as well, unlike the value path,
which has always been gated by isFromClient.

A programmatic operation change no longer fires a load of its own; the caller
applies the filter explicitly when a reload is intended. The tests that used
the automatic load as an instrument now emulate the client-driven gesture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenericFilter: restoring filter state from the URL fires a redundant data load when a condition operation differs

1 participant