Skip to content

Commit 3b708f7

Browse files
committed
fix errors with invalid params in find getter
This uses the isRef utility to check if the params variable is a ref or not. It prevents errors when the params are null, which is a valid use case.
1 parent 015ae99 commit 3b708f7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/service-module/service-module.getters.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { filterQuery, sorter, select } from '@feathersjs/adapter-commons'
99
import { globalModels as models } from './global-models'
1010
import _get from 'lodash/get'
1111
import _omit from 'lodash/omit'
12+
import { isRef } from '@vue/composition-api'
1213

1314
const FILTERS = ['$sort', '$limit', '$skip', '$select']
1415
const OPERATORS = ['$in', '$nin', '$lt', '$lte', '$gt', '$gte', '$ne', '$or']
@@ -21,7 +22,9 @@ export default function makeServiceGetters() {
2122
return state.ids.map(id => state.keyedById[id])
2223
},
2324
find: state => params => {
24-
params = params.value || params // Unwrap a ref
25+
if (isRef(params)) {
26+
params = params.value
27+
}
2528
params = { ...params } || {}
2629

2730
// Set params.temps to true to include the tempsById records

0 commit comments

Comments
 (0)