Skip to content

Commit 25433c6

Browse files
committed
fix useQuery error when data is undefined
1 parent 98df46a commit 25433c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/composables/useDB.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Query {
119119

120120
const { where, order, limit, skip, search, surround, only, without, config } = this.query
121121

122-
let records = data.filter(compile(where))
122+
let records = (data ?? []).filter(compile(where))
123123

124124
if (!surround && search && records.length) {
125125
records = fuzzysort.go(search, records, config).map(res => res.obj)

0 commit comments

Comments
 (0)