retrieve all from indexed db in one call

This commit is contained in:
Julien Calixte
2025-01-12 10:58:03 +01:00
parent 2661ae0a67
commit 4512530250
2 changed files with 43 additions and 20 deletions

View File

@@ -121,15 +121,27 @@ class Data {
keys: keys.map((key) => this.generateId(prefix, key))
})
return response.rows
.map((row) => {
if ('error' in row) {
return null
}
if (includeDocs) {
return response.rows
.map((row) => {
if ('error' in row) {
return null
}
return row.doc
})
.filter((doc) => !!doc) as T[]
return row.doc
})
.filter(Boolean) as T[]
} else {
return response.rows
.map((row) => {
if ('error' in row) {
return null
}
return { _id: row.id }
})
.filter(Boolean) as T[]
}
}
const response = await this.locale.allDocs({