Skip to content

fix(dataview): register full nested HasOne path for fulltext query filter#35

Open
jindrak02 wants to merge 3 commits into
mainfrom
bug/datagrid-queryfilter-nested-hasone-paths
Open

fix(dataview): register full nested HasOne path for fulltext query filter#35
jindrak02 wants to merge 3 commits into
mainfrom
bug/datagrid-queryfilter-nested-hasone-paths

Conversation

@jindrak02
Copy link
Copy Markdown

@jindrak02 jindrak02 commented May 15, 2026

Fixes #34

Problem

<DataGridTextColumn field={it.author.name} /> over a HasOne relation registered the wrong field path for the toolbar <DataGridQueryFilter />: the collector proxy only kept the last accessed segment ("name"), so the auto-built createFullTextFilterHandler produced a where clause against a non-existent Article.name field — search silently returned zero rows (or failed). Grids whose only text data lives behind a oneHasOne / manyHasOne relation had no working toolbar search.

Fix (option 3 from the issue — the general one)

Thread the absolute dotted path through the collector proxy so nested HasOne fields carry their full chain.

  • collectorProxy.tscreateCollectorProxy / createCollectorFieldRef now take a parentPath and compute a fullPath (['author', 'name']). fieldName / path stay relative (last segment) so selection/relation metadata is unaffected; has-many items start a fresh path (dotted where/sort paths only make sense across has-one chains).
  • handles/types.tsFieldRefMeta gains an optional fullPath?: readonly string[].
  • columns.tsxextractFieldName returns the joined fullPath ("author.name") when present, else the field name. DataGridColumn.renderCell uses accessField for nested access.
  • columnTypes.tsaccessField now traverses dotted paths through has-one relations.

createFullTextFilterHandler already supported dotted paths via buildNestedWhere; this just feeds it the correct path.

Test

tests/react/dataview/dataGridFulltextNestedFields.test.tsx — a grid whose only text data is it.author.name now registers the QUERY_FILTER_NAME handler and produces { author: { name: { containsCI: 'John' } } }. Failed on main, passes here.

Test plan

  • bun test tests/react/dataview/dataGridFulltextNestedFields.test.tsx — 1 pass
  • bun run typecheck — clean

jindrak02 and others added 3 commits May 15, 2026 15:26
DataGrid columns whose searchable/sortable text lives inside a HasOne
relation (e.g. `<DataGridTextColumn field={it.author.name} />`) only
registered the last path segment (`"name"`), so the auto-built
`createFullTextFilterHandler` produced a where clause against a
non-existent `Article.name` field instead of `{ author: { name: ... } }`.

The collector proxy now records an absolute `fullPath` on each field
ref's `FIELD_REF_META`, threaded through has-one nesting. `fieldName` /
`path` stay relative (last segment) so selection and relation metadata —
which drive query/selection building via SelectionScope — are unchanged.
The DataGrid column layer reads the dotted `fullPath` via
`extractFieldName`, and `accessField` now traverses dotted paths so
nested cell value extraction works too. Filter/sort handlers already
split on `.` (buildNestedWhere / buildNestedOrderBy), so the dotted path
flows straight through.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The repro comments/title still described the pre-fix failing state. Update
them to reflect that the fix threads the full dotted path, so the test now
documents the guaranteed behavior rather than a known bug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matej21 matej21 changed the title test: failing repro for fulltext query filter not registrable on HasOne nested text fields fix(dataview): register full nested HasOne path for fulltext query filter Jun 1, 2026
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.

DataGridQueryFilter cannot register nested HasOne text fields for fulltext search

2 participants