Skip to content

[Studio UI] Filter sidebars: apply on Enter in the remaining modules #454

Description

@ValeriaMaltseva

Affected capability

Core

Feature description

Context

pimcore/studio-ui-bundle#4012 (fixes #354) made the Translations "Search & Filter" sidebar apply immediately: pressing Enter in the top search field, or in a text field filter, now applies without a separate click on "Apply".

It achieved that by adding an optional onCommit callback to the shared filter components (DynamicFilterProviderFieldFilters, consumed by DynamicTypeFieldFilterTextComponent via onPressEnter) and wiring exactly one host — Translations. The plumbing is deliberately host-agnostic, but the remaining five sidebars still require "Apply".

What is missing

FieldFilters has six hosts; only Translations passes onCommit:

Module Host onCommit
Translations translations/translations-sidebar/components/filter-tab/filter-tab.tsx:104
Element listing (Data Objects / Assets / Documents) element/listing/decorators/general-filters/view-layer/components/sidebar/tabs/filters/filter-container-inner.tsx:179
Notes & Events notes-and-events/notes-and-events-sidebar/components/search-filter-tab/search-filters-tab.tsx:101
Notifications notifications/notifications-sidebar/components/filter-tab/filter-tab.tsx:85
Recycle Bin recycle-bin/recycle-bin-sidebar/components/filter-tab/filter-tab.tsx:101
Reports reports/reports-view/components/report-sidebar/components/columns-filters/columns-filters.tsx:104

Separately, the top search field still has the original #354 bug in two modules — SearchTermControl wires only onChange, so Enter and the magnifier icon do nothing:

  • notes-and-events/filters/filters.tsx:104
  • recycle-bin/filters/filters.tsx:100

Notifications and Reports have no search-term control, so they need the field-filter part only.

All paths are relative to assets/js/src/core/modules/ in pimcore/studio-ui-bundle.

Proposed work

Per module:

  1. Add an onFilterCommit to the module's use*FieldFilterEditor hook that writes the committed value into that module's applied filter store, mirroring translations/filters/hooks/use-translations-field-filter-editor.ts.
  2. Pass onCommit={ onFilterCommit } to <FieldFilters>.
  3. For Notes & Events and Recycle Bin, add an onSearch handler to SearchTermControl.

No change to the shared components should be needed — commit is already optional and each host opts in by passing onCommit.

Decision to settle first

This applies to all six modules, Translations included, and should be agreed before the work starts: on commit, should the applied store receive only the committed key, or the entire current draft?

  • Translations currently applies the whole draft — appliedStore.setValues({ ...draftStore.values, searchTerm: value }) — so Enter in the search box also applies field-filter values the user typed but did not apply.
  • The element listing's own SearchTermFilter writes a single key instead: setAppliedValue('searchTerm', currentSearchTerm).
  • FiltersStore.setValues merges into the previous values, so a single-key write already preserves everything else that was applied.

One asymmetry makes this more than a style question: the element listing wraps its sidebar in useDraftSync, so an applied change there is pushed back into the draft — a single-key write would then discard other unapplied draft edits. Translations does not use useDraftSync. Whichever semantics we pick has to account for both cases.

Ideally the chosen behaviour lives in a helper in components/filters (or in the store itself) rather than being re-implemented in six hooks.

Out of scope but worth noting

  • FieldFilters lives in core/components but has no Storybook story, although it now carries a new public interaction path.
  • There are no tests covering the filters framework, FieldFilters, or the field-filter dynamic types, so there is no existing seam to extend for regression coverage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Fields

Platform Version

None yet

Affected capability

None yet

Galaxy

Horizon

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions