fix(dataview): align IsDefined filter handler onto nullCondition convention#37
Open
jindrak02 wants to merge 2 commits into
Open
fix(dataview): align IsDefined filter handler onto nullCondition convention#37jindrak02 wants to merge 2 commits into
jindrak02 wants to merge 2 commits into
Conversation
… field-name mismatch
…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>
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.
Fixes #36
Problem
DataGridIsDefinedFilterControlsandcreateIsDefinedFilterHandlerread/write different fields on the filter artifact. The controls (viaDataViewNullFilterTrigger→useDataViewNullFilter) writenullCondition: boolean— the convention every other filter handler uses — whilecreateIsDefinedFilterHandleronly inspecteddefined: boolean | null. Clicking ✓/✗ in the popover wrotenullConditionbut the handler stayed inactive, so the filter had no effect on the data. The broken combination shipped unnoticed becauseDataGridIsDefinedColumnhas no in-repo usage.Fix
Align the handler onto the shared
nullConditionconvention (least-disruptive option from the issue, sinceDataViewNullFilterTriggeris generic infra used by many components).dataview/types.ts—IsDefinedFilterArtifactis now{ readonly nullCondition?: boolean }.dataview/filterHandlers.ts—defaultArtifact→{};isActive→nullCondition !== undefined;toWhere→buildNestedWhere(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 thenullConditionshape.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