Skip to content

Commit 48e76f8

Browse files
fix(tables): honor OR boundary when skipping incomplete filter rows
1 parent bfaa366 commit 48e76f8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

apps/sim/lib/table/query-builder/converters.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ export function filterRulesToFilter(rules: FilterRule[]): Filter | null {
2121
let currentGroup: Filter = {}
2222

2323
for (const rule of rules) {
24-
// Skip incomplete rows (no column selected) so a blank builder row never
25-
// serializes to a `{ '': ... }` predicate.
26-
if (!rule.column) continue
27-
24+
// Honor the OR boundary before skipping incomplete rows, so an incomplete
25+
// `or` row between two valid conditions still starts a new group.
2826
const isOr = rule.logicalOperator === 'or'
29-
const ruleValue = toRuleValue(rule.operator, rule.value)
30-
3127
if (isOr && Object.keys(currentGroup).length > 0) {
3228
orGroups.push({ ...currentGroup })
3329
currentGroup = {}
3430
}
3531

32+
// Skip incomplete rows (no column selected) so a blank builder row never
33+
// serializes to a `{ '': ... }` predicate. The OR boundary above is still
34+
// applied; the row just contributes no condition.
35+
if (!rule.column) continue
36+
37+
const ruleValue = toRuleValue(rule.operator, rule.value)
3638
const existing = currentGroup[rule.column]
3739
currentGroup[rule.column] =
3840
existing === undefined

0 commit comments

Comments
 (0)