Skip to content

[WC-3417]: Datagrid Text Filter: fix string filter's empty and non-empty operators#2225

Open
rahmanunver wants to merge 1 commit into
mainfrom
fix/dg2-string-filter-empty
Open

[WC-3417]: Datagrid Text Filter: fix string filter's empty and non-empty operators#2225
rahmanunver wants to merge 1 commit into
mainfrom
fix/dg2-string-filter-empty

Conversation

@rahmanunver
Copy link
Copy Markdown
Contributor

Pull request type

Bug fix (non-breaking change which fixes an issue)


Description

The DataGrid 2 text filter's Empty and Not empty operators returned the same results for rows whose text was entered, cleared, and saved again.

The Mendix runtime delivers cleared string attributes to us as "" (empty string), not null. Our filter store was emitting equals(attr, literal(undefined)), which only matches null-valued rows, so "" rows fell through both operators.

We chose to fix this in the filter store rather than upstream because the value arrives at our filter as a legitimate string — changing how the runtime or input widgets persist cleared fields would affect every consumer of String attributes, not just this filter. Scoping the fix to StringInputFilterStore keeps the blast radius contained.

The string filter now emits a compound condition:

  • Emptyor(equals(attr, undefined), equals(attr, ""))
  • Not emptyand(notEqual(attr, undefined), notEqual(attr, ""))

Number and Date stores are untouched — Number cannot hold "", and Date clears persist as null.

What should be covered while testing?

  1. Add a row, type a value into a text attribute, save.
  2. Edit the row, clear the value, save again (DB now holds "").
  3. Apply the column text filter Empty → cleared row appears.
  4. Apply the column text filter Not empty → cleared row is hidden.
  5. Regression: rows that were never set still appear under Empty and stay hidden under Not empty.

@rahmanunver rahmanunver requested a review from a team as a code owner May 22, 2026 14:00
@rahmanunver rahmanunver changed the title fix(datagrid-web): match empty string in string filter's =empty / !=empty operators [WC-3417]: Datagrid Text Filter: fix string filter's empty and non-empty operators May 22, 2026
Comment on lines +37 to +40
// Mendix runtime emits lowercase "string"; the shared test mock emits "String".
// Accept both so detection works in tests AND in production.
const vt = exp.arg2.valueType as string;
return (vt === "string" || vt === "String") && exp.arg2.value === "";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? If mock is not behaving the same as the real life, we should fix the mock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants