Skip to content

Commit

Permalink
fix multicondition and import
Browse files Browse the repository at this point in the history
  • Loading branch information
sliterok committed Mar 9, 2024
1 parent db02d19 commit 04fb52f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class OPFSDB<T extends IBasicRecord> {
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
}
Expand Down
7 changes: 3 additions & 4 deletions src/routes/UserGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<IImportInput<IUser>>('/db/users/import', {
records,
})
await new Promise(res => setTimeout(res, 20))
}
})

Expand Down

0 comments on commit 04fb52f

Please sign in to comment.