MCPcopy Index your code
hub / github.com/TanStack/db / assertNoPushdownViolation

Function assertNoPushdownViolation

packages/db-collection-e2e/src/utils/assertions.ts:140–157  ·  view source on GitHub ↗
(
  collection: Collection<T>,
  expectedMaxIds: Array<string>,
  message?: string,
)

Source from the content-addressed store, hash-verified

138 * This checks that the collection didn't load more data than necessary
139 */
140export function assertNoPushdownViolation<T extends { id: string }>(
141 collection: Collection<T>,
142 expectedMaxIds: Array<string>,
143 message?: string,
144) {
145 const loadedIds = getLoadedIds(collection)
146 const expectedSet = new Set(expectedMaxIds)
147
148 // Check if any loaded IDs are not in expected set
149 const extraIds = loadedIds.filter((id) => !expectedSet.has(id))
150
151 if (extraIds.length > 0) {
152 throw new Error(
153 message ??
154 `Predicate pushdown violation: Collection loaded ${extraIds.length} extra item(s) that don't match the predicate`,
155 )
156 }
157}
158
159/**
160 * Assert that deduplication occurred

Callers

nothing calls this directly

Calls 3

getLoadedIdsFunction · 0.90
filterMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…