[Element Editor] Fix relation grid search not matching visible column values - #3911
[Element Editor] Fix relation grid search not matching visible column values#3911mw-keoz wants to merge 2 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Pull request overview
Verdict: Needs changes. The fix correctly restores visible-column search by attaching each row ID at the producer boundary (many-to-many-object-relation.tsx:227).
Changes:
- Adds row IDs to visible-field records, addressing the root cause.
- Preserves fallback search and existing APIs.
- No automated regression test was added; the narrow search behavior should be covered before approval.
- One non-blocking type-check convention nit remains at line 227.
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks for the review — both points addressed in
Locally green: FYI the red |
… values In the many-to-many object relation editor the search box should match the configured visibleFields column values, not only the object path. applySearchFilter joins each row to its visible-field values by id (a Map keyed by field.id, dropping nil-id entries), but the visibleFieldsValue producer emitted only column key/value pairs with no id, so every entry was dropped and search silently fell back to matching fullPath only. Attach the row id to each produced record so the join resolves.
…defined guard - Add a renderHook(useValue) regression test for visible-column search: a column value matches only when visibleFieldsValue entries carry the row id, and the filter falls back to fullPath when they do not. - Use lodash isUndefined for the producer's undefined check, matching the file's existing guard style (review feedback).
51c164c to
2011b53
Compare
|
|
@mw-keoz At the moment, I can't reproduce this issue, either on 2025.4.9 or 2026.2.2. Could you please double-check whether the problem still persists? If it does, would you mind providing some additional details or steps to reproduce it? That would help us investigate further. Thanks! |
ValeriaMaltseva
left a comment
There was a problem hiding this comment.
@mw-keoz
Hi! Just wanted to kindly remind you about this. Thanks! :)



What
Fix search in the many-to-many object relation editor so it matches the visible column values, not only the object path.
Why
When a many-to-many object relation is configured with
visibleFields, the search box above the grid should match those visible column values.applySearchFilter(core/components/many-to-many-relation/hooks/use-value.ts) joins each grid row to its visible-field values by id: it builds aMapkeyed byfield.id, dropping any entry with a nil id (.filter(field => !isNil(field?.id))), then looks upvisibleFieldsMap.get(item.id).But the producer (
visibleFieldsValueinmany-to-many-object-relation.tsx) emits only the column key/value pairs, with noid. Every entry is therefore dropped from the map, the visible-field branch never matches, and search silently falls back to matchingfullPathonly — so typing a value that is plainly visible in a column returns nothing.Fix
Attach the row
idto each produced record so the join resolves.const visibleFieldsValue = useMemo(() => { return mergedGridFullData.map(item => { - return item?.columns?.reduce<Record<string, any>>((acc, col) => { + const columns = item?.columns?.reduce<Record<string, any>>((acc, col) => { acc[col.key!] = col.value return acc }, {}) + + return columns === undefined ? undefined : { ...columns, id: item.id } }) }, [mergedGridFullData])The
fullPath/id/type fallback branch is untouched.Testing
visibleFieldsconfigured; assign a few objects; type a value that appears in a visible column (not in the path). Before: no match. After: the row matches. Path/id/type search unchanged.