Commit 220a18f
authored
fix(ui): equals filter shows no results when value is cleared (#14673)
### What?
Fixes a bug where clearing the value of an 'equals' filter in the
collection list view would show no results (or only documents with empty
string values) instead of showing all documents.
### Why?
When a user cleared a filter value using backspace or delete, the
WhereBuilder was converting the `null` value to an empty string `''`.
This caused the query to become `equals=''`, which filtered for
documents where the field equals an empty string, rather than treating
it as "no filter" and showing all documents.
This was inconsistent with the initial behavior when a filter is first
added without a value, where all documents are displayed.
### How?
Updated the `updateValue` function to pass `undefined` instead of an
empty string when the debounced value is `null` or empty:
```typescript
value: debouncedValue === null || debouncedValue === '' ? undefined : debouncedValue,
```
Fixes #146271 parent af6ba86 commit 220a18f
File tree
3 files changed
+57
-2
lines changed- packages/ui/src/elements/WhereBuilder/Condition
- test/admin
- e2e/list-view
3 files changed
+57
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
745 | 772 | | |
746 | 773 | | |
747 | 774 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| 139 | + | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| |||
637 | 640 | | |
638 | 641 | | |
639 | 642 | | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
640 | 660 | | |
641 | 661 | | |
642 | 662 | | |
| |||
1227 | 1247 | | |
1228 | 1248 | | |
1229 | 1249 | | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
1230 | 1258 | | |
1231 | 1259 | | |
1232 | 1260 | | |
| |||
0 commit comments