Skip to content

fix(dataview): align IsDefined filter handler onto nullCondition convention#37

Open
jindrak02 wants to merge 2 commits into
mainfrom
bug/isdefined-filter-controls-handler-field-mismatch
Open

fix(dataview): align IsDefined filter handler onto nullCondition convention#37
jindrak02 wants to merge 2 commits into
mainfrom
bug/isdefined-filter-controls-handler-field-mismatch

Conversation

@jindrak02
Copy link
Copy Markdown

@jindrak02 jindrak02 commented May 15, 2026

Fixes #36

Problem

DataGridIsDefinedFilterControls and createIsDefinedFilterHandler read/write different fields on the filter artifact. The controls (via DataViewNullFilterTriggeruseDataViewNullFilter) write nullCondition: boolean — the convention every other filter handler uses — while createIsDefinedFilterHandler only inspected defined: boolean | null. Clicking ✓/✗ in the popover wrote nullCondition but the handler stayed inactive, so the filter had no effect on the data. The broken combination shipped unnoticed because DataGridIsDefinedColumn has no in-repo usage.

Fix

Align the handler onto the shared nullCondition convention (least-disruptive option from the issue, since DataViewNullFilterTrigger is generic infra used by many components).

  • dataview/types.tsIsDefinedFilterArtifact is now { readonly nullCondition?: boolean }.
  • dataview/filterHandlers.tsdefaultArtifact{}; isActivenullCondition !== undefined; toWherebuildNestedWhere(fieldPath, { isNull: nullCondition }).

Semantics: nullCondition: false = exclude nulls (is-defined); true = nulls only (not-defined); undefined = off — matching the ✓/✗ button copy.

Tests

  • tests/unit/dataview/filterHandlers.test.ts — existing cases updated to the nullCondition shape.
  • tests/unit/dataview/isDefinedHandlerNullConditionCompat.test.ts — new regression test asserting the artifact the ✓/✗ buttons actually write (nullCondition: false / true) activates the handler and yields the right where clause.

Test plan

  • bun test tests/unit/dataview/filterHandlers.test.ts tests/unit/dataview/isDefinedHandlerNullConditionCompat.test.ts — 45 pass

jindrak02 and others added 2 commits May 15, 2026 18:06
…ention

`createIsDefinedFilterHandler` read/wrote `artifact.defined`, but the UI
controls (DataGridIsDefinedFilterControls -> DataViewNullFilterTrigger ->
useDataViewNullFilter) write `nullCondition` — the convention used by every
other filter handler. As a result the IsDefined filter never activated when
clicked (issue #36).

Reshape `IsDefinedFilterArtifact` to `{ nullCondition?: boolean }`:
- defaultArtifact() -> {}
- isActive -> nullCondition !== undefined
- toWhere -> { isNull: nullCondition } when defined, else undefined

Semantics: nullCondition:false = exclude nulls (is-defined);
nullCondition:true = include-nulls-only (not-defined). Existing
filterHandlers tests updated to the new shape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matej21 matej21 changed the title test: failing repro for IsDefined filter handler vs NullFilterTrigger field-name mismatch fix(dataview): align IsDefined filter handler onto nullCondition convention 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.

DataGridIsDefinedFilterControls writes nullCondition but createIsDefinedFilterHandler reads defined — clicks never activate the filter

2 participants