@@ -9,6 +9,7 @@ import { filterQuery, sorter, select } from '@feathersjs/adapter-commons'
9
9
import { globalModels as models } from './global-models'
10
10
import _get from 'lodash/get'
11
11
import _omit from 'lodash/omit'
12
+ import _unionBy from 'lodash/unionBy'
12
13
13
14
const FILTERS = [ '$sort' , '$limit' , '$skip' , '$select' ]
14
15
const OPERATORS = [ '$in' , '$nin' , '$lt' , '$lte' , '$gt' , '$gte' , '$ne' , '$or' ]
@@ -26,7 +27,7 @@ export default function makeServiceGetters() {
26
27
// Set params.temps to true to include the tempsById records
27
28
params . temps = params . hasOwnProperty ( 'temps' ) ? params . temps : false
28
29
29
- const { paramsForServer, whitelist } = state
30
+ const { paramsForServer, whitelist, idField , tempIdField } = state
30
31
const q = _omit ( params . query || { } , paramsForServer )
31
32
const customOperators = Object . keys ( q ) . filter (
32
33
k => k [ 0 ] === '$' && ! defaultOps . includes ( k )
@@ -39,7 +40,11 @@ export default function makeServiceGetters() {
39
40
let values = _ . values ( state . keyedById )
40
41
41
42
if ( params . temps ) {
42
- values = values . concat ( _ . values ( state . tempsById ) )
43
+ values = _unionBy (
44
+ values ,
45
+ _ . values ( state . tempsById ) ,
46
+ i => i [ tempIdField ] || i [ idField ]
47
+ )
43
48
}
44
49
45
50
values = values . filter ( sift ( query ) )
0 commit comments