Skip to content

Commit 7cdd1db

Browse files
committed
revert(webapp): drop hasSome and hasEvery from the list-filter rule
Measured against a local Postgres: hasSome compiles to `tags && $1` and hasEvery to `tags @> $1`, passing the whole array as one bind parameter. Six arities produced one statement text, against six for an `in` control. Arity never reached the statement, so bounding them added elements for no benefit.
1 parent 42ab21f commit 7cdd1db

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

apps/webapp/app/presenters/v3/WaitpointListPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class WaitpointListPresenter extends BasePresenter {
200200
},
201201
}
202202
: {}),
203-
...(tags && tags.length > 0 ? { tags: { hasSome: boundedIn(tags) } } : {}),
203+
...(tags && tags.length > 0 ? { tags: { hasSome: tags } } : {}),
204204
},
205205
orderBy: { id: direction === "forward" ? "desc" : "asc" },
206206
take: pageSize + 1,

oxlint-plugins/prisma-in-filter.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const VALUE_POSITION = new Set([
3737
]);
3838

3939
/**
40-
* Scalar-list membership filters expand the same way `in` does: one bind parameter per element,
41-
* so arity changes the statement text. `hasSome` becomes `&&` and `hasEvery` becomes `@>`, and
42-
* both ignore duplicates in the right-hand array, so padding is as safe here as it is for `in`.
43-
* `has` takes a single value, not a list, so it is deliberately absent.
40+
* Only `in` and `notIn` expand to one bind parameter per element. The scalar-list filters
41+
* `hasSome` and `hasEvery` compile to `&& $1` and `@> $1`, passing the whole array as a single
42+
* parameter, so their arity never reaches the statement text and bounding them would add
43+
* elements for no benefit.
4444
*/
45-
const LIST_FILTERS = new Set(["in", "notIn", "hasSome", "hasEvery"]);
45+
const LIST_FILTERS = new Set(["in", "notIn"]);
4646

4747
/**
4848
* Helpers whose first argument IS a where clause, so the filter arrives as a bare object

0 commit comments

Comments
 (0)