Skip to content

Commit 4201bb5

Browse files
committed
test(objectql): the record-currency find double applies the limit before copying rows
Claude-Session: https://claude.ai/code/session_01Utp6CboxRwQPbQZnhxyuzt Co-authored-by: Claude <noreply@anthropic.com>
1 parent 901cbb0 commit 4201bb5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/objectql/src/record-currency-guards.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ function makeDriver() {
4343
name: 'memory', version: '0.0.0', supports: {},
4444
async connect() {}, async disconnect() {}, async checkHealth() { return true; }, async execute() { return null; },
4545
async find(object: string, ast: any) {
46-
const rows = Array.from(storeFor(object).values()).filter((r) => matches(r, ast?.where)).map((r) => ({ ...r }));
47-
return typeof ast?.limit === 'number' ? rows.slice(0, ast.limit) : rows;
46+
const rows = Array.from(storeFor(object).values()).filter((r) => matches(r, ast?.where));
47+
const page = typeof ast?.limit === 'number' ? rows.slice(0, ast.limit) : rows;
48+
return page.map((r) => ({ ...r }));
4849
},
4950
async findOne(object: string, ast: any) {
5051
for (const r of storeFor(object).values()) if (matches(r, ast?.where)) return { ...r };

0 commit comments

Comments
 (0)