[Studio UI] Filter sidebars: apply on Enter in the remaining modules - #4090
Open
ValeriaMaltseva wants to merge 4 commits into
Open
[Studio UI] Filter sidebars: apply on Enter in the remaining modules#4090ValeriaMaltseva wants to merge 4 commits into
ValeriaMaltseva wants to merge 4 commits into
Conversation
#4012 made the Translations sidebar apply on Enter by adding an optional onCommit to the shared filter components and wiring one host. The plumbing was host-agnostic but the other five sidebars still required a click on "Apply", and the top search field ignored Enter and the magnifier in Notes & Events and Recycle Bin. Committing publishes the whole draft, not only the committed key. A single-key write looks equivalent because FiltersStore.setValues merges, but the element listing mirrors the applied store back into the draft via useDraftSync, which would then overwrite the user's other unapplied edits. Publishing the whole draft also keeps Enter and "Apply" doing the same thing. That rule now lives in one place, commitFilterValues. Every host follows the same shape: one applyFilters() that the Apply button calls, injected into its field-filter editor hook as onCommit, and published through FilterCommitProvider for the controls that FiltersRenderer builds and so cannot receive a prop. - components/filters: add commitFilterValues and the FilterCommit context; useFilterQuery's builder takes optional value overrides, for the one host (Reports) that has no applied store. - Element listing: SearchTermFilter.onSearch was a no-op whenever the field was rendered in the sidebar; it now goes through the panel's commit, which also resets paging. Outside the sidebar (element selectors, search modals) it keeps writing straight to the applied store. - Notes & Events, Recycle Bin: add onSearch to their search controls. - Notes & Events, Notifications, Recycle Bin, Translations, Reports: pass onCommit to FieldFilters. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-module filter behavior requires final human review and browser verification.
Pull request overview
Extends Enter-to-apply filtering across all remaining filter sidebars while preserving whole-draft semantics.
Changes:
- Adds shared filter commit context and whole-draft commit utility.
- Enables Enter and search-icon application across six filter hosts.
- Adds query override support and commit-helper tests.
File summaries
| File | Change |
|---|---|
assets/js/src/core/modules/translations/translations-sidebar/components/filter-tab/filter-tab.tsx |
Adopts shared commit behavior. |
assets/js/src/core/modules/translations/filters/hooks/use-translations-field-filter-editor.ts |
Delegates field commits to the host. |
assets/js/src/core/modules/translations/filters/filters.tsx |
Uses the shared commit context. |
assets/js/src/core/modules/reports/reports-view/components/report-sidebar/components/columns-filters/use-field-filter-editor.ts |
Exposes report filter commits. |
assets/js/src/core/modules/reports/reports-view/components/report-sidebar/components/columns-filters/columns-filters.tsx |
Applies committed report filters. |
assets/js/src/core/modules/recycle-bin/recycle-bin-sidebar/components/filter-tab/filter-tab.tsx |
Wires search and field commits. |
assets/js/src/core/modules/recycle-bin/filters/hooks/use-recycle-bin-field-filter-editor.ts |
Adds field-filter commit handling. |
assets/js/src/core/modules/recycle-bin/filters/filters.tsx |
Handles search submission. |
assets/js/src/core/modules/notifications/notifications-sidebar/components/filter-tab/filter-tab.tsx |
Wires notification filter commits. |
assets/js/src/core/modules/notifications/filters/hooks/use-notifications-field-filter-editor.ts |
Adds field-filter commit handling. |
assets/js/src/core/modules/notes-and-events/notes-and-events-sidebar/components/search-filter-tab/search-filters-tab.tsx |
Wires search and field commits. |
assets/js/src/core/modules/notes-and-events/filters/hooks/use-notes-field-filter-editor.ts |
Adds field-filter commit handling. |
assets/js/src/core/modules/notes-and-events/filters/filters.tsx |
Handles search submission. |
assets/js/src/core/modules/element/listing/decorators/general-filters/view-layer/components/sidebar/tabs/filters/filter-container-inner.tsx |
Unifies listing filter application. |
assets/js/src/core/modules/element/listing/decorators/general-filters/view-layer/components/sidebar/tabs/filters/field-filters/use-field-filter-editor.tsx |
Exposes field-filter commits. |
assets/js/src/core/modules/element/listing/decorators/general-filters/view-layer/components/search/search-term-filter.tsx |
Applies sidebar searches immediately. |
assets/js/src/core/components/filters/store/filter-commit-context.tsx |
Provides commits to rendered controls. |
assets/js/src/core/components/filters/store/commit-filter-values.ts |
Implements whole-draft commits. |
assets/js/src/core/components/filters/store/commit-filter-values.test.ts |
Tests commit merge behavior. |
assets/js/src/core/components/filters/index.ts |
Exports the new commit APIs. |
assets/js/src/core/components/filters/adapter.ts |
Supports query overrides for pending values. |
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-module interaction changes span 21 files and were not browser-verified, warranting final human validation.
Review details
Suppressed comments (1)
assets/js/src/core/components/filters/adapter.ts:32
overrides === undefinedviolates the repository's mandatory type-check convention, which requires lodash guards instead of direct undefined comparisons (.github/copilot-instructions.md:231-233). Defaulting the optional argument and merging it unconditionally avoids the direct comparison without changing the API.
composeQuery(adapter.descriptors, overrides === undefined ? appliedValues : { ...appliedValues, ...overrides }, context),
- Files reviewed: 21/22 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Review feedback: `overrides === undefined` is a direct undefined comparison, which .github/copilot-instructions.md rules out. Defaulting the optional argument drops the comparison altogether rather than swapping it for isUndefined, and keeps the API unchanged. composeQuery only reads values by key, so the extra shallow copy is behaviour-neutral. Co-Authored-By: Claude <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
#4012 (fixes pimcore/platform-version#354) made the Translations "Search & Filter" sidebar apply immediately, by adding an optional
onCommitto the shared filter components (DynamicFilterProvider→FieldFilters, consumed byDynamicTypeFieldFilterTextComponentviaonPressEnter) and wiring exactly one host. The plumbing was deliberately host-agnostic, but the other five sidebars still required a click on "Apply", and the top search field still ignored Enter and the magnifier in two modules.This wires up the remaining five and closes the search-field gap.
The decision that had to be settled first
On commit, the applied store receives the whole current draft, not only the committed key.
A single-key write looks equivalent —
FiltersStore.setValuesmerges, so previously applied values survive — but the element listing wraps its sidebar inuseDraftSync, which mirrors the applied store back into the draft. A single-key write there would push the previously applied values back over the other filters the user had typed but not applied, silently discarding them. Publishing the whole draft also keeps Enter and "Apply" doing exactly the same thing, which is the easier rule to explain.That rule now lives in one place —
commitFilterValuesincomponents/filters— rather than being re-implemented per host, and it is the only part of this PR with a unit test.The shape, now identical in all six hosts
Two transports rather than one, because they are forced: the host renders
FieldFiltersdirectly, so a prop works;FiltersRendererconstructs controls from descriptors, so only a context reaches them. Notifications and Reports have no renderer-built controls and use steps 1–3 only.Changes
components/filtersstore/commit-filter-values.ts— newcommitFilterValues(appliedStore, draftValues, committed?), with the reasoning above recorded in its doc comment. Covered bycommit-filter-values.test.ts.store/filter-commit-context.tsx— newFilterCommitProvider/useFilterCommitOptional, so a control built byFiltersRenderercan reach the host's apply.adapter.ts—useFilterQuery's returned builder takes an optional secondoverridesargument, for the one host (Reports) that has no applied store to write into. Additive; existing callers are unaffected.Element listing (Data Objects / Assets / Documents)
search-term-filter.tsx—onSearchwasif (!handleSearchTermInSidebar) { … }, i.e. a no-op in exactly the case where the field is rendered in the sidebar. It now goes through the panel's commit, which also resets paging. Outside the sidebar (element selectors, search modals — all of which sethandleSearchTermInSidebar: false) it keeps writing straight to the applied store, unchanged.filter-container-inner.tsx— the Apply handler is extracted intoapplyFilters(committed?), shared by the button, the search field and the field filters, so the three cannot drift. It still shapes which keys are published (pqlonly in advanced mode,unreferenced/searchTermonly when configured) and still callssetPage(1)+setDataLoadingState('filters-applied').use-field-filter-editor.tsx— takesonCommit, returnsonFilterCommit.Notes & Events, Recycle Bin
filters.tsx—SearchTermControlwired onlyonChange, so Enter and the magnifier did nothing (the original [Versions] Show date/time with seconds #354 bug, still present in these two). AddedonSearch.onFilterCommiton the field filters.Notifications, Reports
onFilterCommiton the field filters. Neither has a search-term control.Translations
Verification
npm run check-types— clean.npx eslint js/src/core— clean.npx jest ./js/src— 60 suites / 441 tests pass, including the 3 new ones.Manual test checklist
For each of Data Objects/Assets/Documents, Notes & Events, Notifications, Recycle Bin, Reports, Translations:
useDraftSynccase the whole-draft decision exists for.commit.Known gaps
Both were called out as out of scope in the issue and are unchanged here:
FieldFiltersstill has no Storybook story despite now carrying a public interaction path, and there is no test coverage of the filters framework or the field-filter dynamic types beyond the pure helper added in this PR — there is no existing seam to extend for the UI behaviour itself.Fixes pimcore/platform-version#454