Skip to content

[WC-3417] Fix string empty/not-empty filters#2236

Open
r0b1n wants to merge 3 commits into
mainfrom
fix/broken-empty-string-filter
Open

[WC-3417] Fix string empty/not-empty filters#2236
r0b1n wants to merge 3 commits into
mainfrom
fix/broken-empty-string-filter

Conversation

@r0b1n
Copy link
Copy Markdown
Collaborator

@r0b1n r0b1n commented May 28, 2026

Summary

Fixed an issue where "is empty" and "is not empty" string filters were not working correctly in some cases.

The root cause was that string attributes can be in two different states: empty or "" (empty string). Previously, the empty() filter matched both states, but due to new string behavior in recent Mendix versions, empty strings must now be matched explicitly.

Changes

  • Updated BaseInputFilterStore.getFilterCondition() to generate compound filter expressions for string attributes:
    • "is empty": attr = empty OR attr = ""
    • "is not empty": attr != empty AND attr != ""
  • Added helper functions isEmptyStringExp() and isNotEmptyStringExp() to recognize these compound expressions
  • Updated inputStateFromCond() to restore filter state from compound expressions
  • Added comprehensive test coverage for the new expression pattern matching

Test plan

  • Unit tests pass
  • E2E tests pass
  • Manual verification in test project with string filters

Because strings can be in two different states, one is `empty`, other is "".
Previously, before 11.6, empty() was matching both, now, because "of new string behavior",
empty strings have to be matched explicitly.
@r0b1n r0b1n requested a review from a team as a code owner May 28, 2026 13:32
Comment thread packages/shared/filter-commons/src/__tests__/condition-utils.spec.ts Outdated
Comment thread packages/shared/filter-commons/src/__tests__/condition-utils.spec.ts Outdated
Comment thread packages/shared/filter-commons/src/__tests__/condition-utils.spec.ts Outdated
iobuhov
iobuhov previously approved these changes May 29, 2026
Copy link
Copy Markdown
Collaborator

@iobuhov iobuhov left a comment

Choose a reason for hiding this comment

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

LGTM

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