@@ -10,8 +10,10 @@ import { Dispatch } from 'redux'
10
10
import { ErrorLevel } from 'models/ErrorReporting'
11
11
import { Kind } from 'models/Kind'
12
12
import { Status } from 'models/Status'
13
+ import { UserMetadata } from 'models/User'
13
14
import { getCollection } from 'store/cache/collections/selectors'
14
15
import { getTrack } from 'store/cache/tracks/selectors'
16
+ import { reformatUser } from 'store/cache/users/utils'
15
17
import { CommonState } from 'store/reducers'
16
18
import { getErrorMessage } from 'utils/error'
17
19
import { Nullable , removeNullable } from 'utils/typeUtils'
@@ -252,6 +254,7 @@ const fetchData = async <Args, Data>(
252
254
context : AudiusQueryContextType ,
253
255
dispatch : Dispatch
254
256
) => {
257
+ const { audiusBackend } = context
255
258
try {
256
259
dispatch (
257
260
// @ts -ignore
@@ -274,6 +277,12 @@ const fetchData = async <Args, Data>(
274
277
apiResponseSchema
275
278
)
276
279
data = result
280
+
281
+ // Format entities before adding to cache
282
+ entities [ Kind . USERS ] = mapValues (
283
+ entities [ Kind . USERS ] ?? [ ] ,
284
+ ( user : UserMetadata ) => reformatUser ( user , audiusBackend )
285
+ )
277
286
dispatch ( addEntries ( Object . keys ( entities ) , entities ) )
278
287
} else {
279
288
data = apiData
0 commit comments