From 04fb52faa48d18ee080e2eba818afa47f5f172a2 Mon Sep 17 00:00:00 2001 From: sliterok <12751644+sliterok@users.noreply.github.com> Date: Sat, 9 Mar 2024 19:54:26 +0100 Subject: [PATCH] fix multicondition and import --- src/db/index.ts | 2 +- src/routes/UserGrid.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/db/index.ts b/src/db/index.ts index d75736a..8cbed73 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -168,7 +168,7 @@ export class OPFSDB { indexes = new Set([...indexes, ...queryIndexes]) } - if (options?.limit && indexes.size > options?.limit) { + if (!options?.isAnd && options?.limit && indexes.size > options?.limit) { indexes = new Set([...indexes].slice(0, options.limit)) break } diff --git a/src/routes/UserGrid.tsx b/src/routes/UserGrid.tsx index 62ba48b..8be15e9 100644 --- a/src/routes/UserGrid.tsx +++ b/src/routes/UserGrid.tsx @@ -76,16 +76,15 @@ export default function MainLayout() { }) const importUsers = useMutation(async () => { - for (let i = 0; i < 15; i++) { - const records = Array(50) + for (let i = 0; i < 10; i++) { + const records = Array(1000) .fill(true) .map(() => generateUser()) // eslint-disable-next-line no-console - console.log(i) + console.log(i * 1000) await dbFetch>('/db/users/import', { records, }) - await new Promise(res => setTimeout(res, 20)) } })