react-redux-cache 0.22.1 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/createActions.js +63 -63
- package/dist/cjs/createCache.js +216 -131
- package/dist/cjs/createReducer.js +355 -290
- package/dist/cjs/createSelectors.js +66 -58
- package/dist/cjs/index.js +87 -26
- package/dist/cjs/mutate.js +153 -70
- package/dist/cjs/query.js +161 -70
- package/dist/cjs/types.js +2 -2
- package/dist/cjs/useMutation.js +81 -42
- package/dist/cjs/useQuery.js +127 -56
- package/dist/cjs/utilsAndConstants.js +204 -151
- package/dist/esm/createActions.js +60 -59
- package/dist/esm/createCache.js +218 -127
- package/dist/esm/createReducer.js +349 -286
- package/dist/esm/createSelectors.js +63 -54
- package/dist/esm/index.js +3 -3
- package/dist/esm/mutate.js +143 -66
- package/dist/esm/query.js +149 -66
- package/dist/esm/types.js +1 -1
- package/dist/esm/useMutation.js +77 -38
- package/dist/esm/useQuery.js +119 -52
- package/dist/esm/utilsAndConstants.js +190 -140
- package/dist/types/createActions.d.ts +109 -83
- package/dist/types/createCache.d.ts +734 -409
- package/dist/types/createReducer.d.ts +11 -3
- package/dist/types/createSelectors.d.ts +80 -18
- package/dist/types/index.d.ts +3 -3
- package/dist/types/mutate.d.ts +94 -4
- package/dist/types/query.d.ts +123 -4
- package/dist/types/types.d.ts +360 -184
- package/dist/types/useMutation.d.ts +39 -4
- package/dist/types/useQuery.d.ts +40 -4
- package/dist/types/utilsAndConstants.d.ts +56 -23
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -333,8 +333,8 @@ For huge collections (> 1000 items, see benchmark) immutable approach may be a b
|
|
|
333
333
|
|
|
334
334
|
| Collection size | 0 | 1000 | 10000 | 100000 | 1000000 |
|
|
335
335
|
|-|-|-|-|-|-|
|
|
336
|
-
| immutable | 1.
|
|
337
|
-
| mutable | 1.
|
|
336
|
+
| immutable | 1.57 | 1.81 | 7.62 | 103.82 | 1457.89 |
|
|
337
|
+
| mutable | 1.4 | 1.15 | 0.65 | 1.03 | 0.76 |
|
|
338
338
|
|
|
339
339
|
Well written code should not subcribe to whole collections, so just enabling this options most of the times should not break anything. But if it is still needed, you should subscribe to both collection (it may still change e.g. when clearing state) and to its `_changeKey`.
|
|
340
340
|
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.createActions = void 0
|
|
4
|
-
const utilsAndConstants_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {value: true})
|
|
3
|
+
exports.createActions = void 0
|
|
4
|
+
const utilsAndConstants_1 = require('./utilsAndConstants')
|
|
5
5
|
const createActions = (name) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
exports.createActions = createActions
|
|
6
|
+
const actionPrefix = `@${utilsAndConstants_1.PACKAGE_SHORT_NAME}/${name}/`
|
|
7
|
+
const updateQueryStateAndEntitiesType = `${actionPrefix}updateQueryStateAndEntities`
|
|
8
|
+
const updateQueryStateAndEntities = (queryKey, queryCacheKey, state, entityChanges) => ({
|
|
9
|
+
type: updateQueryStateAndEntitiesType,
|
|
10
|
+
queryKey,
|
|
11
|
+
queryCacheKey,
|
|
12
|
+
state,
|
|
13
|
+
entityChanges,
|
|
14
|
+
})
|
|
15
|
+
updateQueryStateAndEntities.type = updateQueryStateAndEntitiesType
|
|
16
|
+
const updateMutationStateAndEntitiesType = `${actionPrefix}updateMutationStateAndEntities`
|
|
17
|
+
const updateMutationStateAndEntities = (mutationKey, state, entityChanges) => ({
|
|
18
|
+
type: updateMutationStateAndEntitiesType,
|
|
19
|
+
mutationKey,
|
|
20
|
+
state,
|
|
21
|
+
entityChanges,
|
|
22
|
+
})
|
|
23
|
+
updateMutationStateAndEntities.type = updateMutationStateAndEntitiesType
|
|
24
|
+
const mergeEntityChangesType = `${actionPrefix}mergeEntityChanges`
|
|
25
|
+
const mergeEntityChanges = (changes) => ({
|
|
26
|
+
type: mergeEntityChangesType,
|
|
27
|
+
changes,
|
|
28
|
+
})
|
|
29
|
+
mergeEntityChanges.type = mergeEntityChangesType
|
|
30
|
+
const invalidateQueryType = `${actionPrefix}invalidateQuery`
|
|
31
|
+
const invalidateQuery = (queries) => ({
|
|
32
|
+
type: invalidateQueryType,
|
|
33
|
+
queries,
|
|
34
|
+
})
|
|
35
|
+
invalidateQuery.type = invalidateQueryType
|
|
36
|
+
const clearQueryStateType = `${actionPrefix}clearQueryState`
|
|
37
|
+
const clearQueryState = (queries) => ({
|
|
38
|
+
type: clearQueryStateType,
|
|
39
|
+
queries,
|
|
40
|
+
})
|
|
41
|
+
clearQueryState.type = clearQueryStateType
|
|
42
|
+
const clearMutationStateType = `${actionPrefix}clearMutationState`
|
|
43
|
+
const clearMutationState = (mutationKeys) => ({
|
|
44
|
+
type: clearMutationStateType,
|
|
45
|
+
mutationKeys,
|
|
46
|
+
})
|
|
47
|
+
clearMutationState.type = clearMutationStateType
|
|
48
|
+
const clearCacheType = `${actionPrefix}clearCache`
|
|
49
|
+
const clearCache = (stateToKeep) => ({
|
|
50
|
+
type: clearCacheType,
|
|
51
|
+
stateToKeep,
|
|
52
|
+
})
|
|
53
|
+
clearCache.type = clearCacheType
|
|
54
|
+
return {
|
|
55
|
+
updateQueryStateAndEntities,
|
|
56
|
+
updateMutationStateAndEntities,
|
|
57
|
+
mergeEntityChanges,
|
|
58
|
+
invalidateQuery,
|
|
59
|
+
clearQueryState,
|
|
60
|
+
clearMutationState,
|
|
61
|
+
clearCache,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.createActions = createActions
|
package/dist/cjs/createCache.js
CHANGED
|
@@ -1,134 +1,219 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.createCache = exports.withTypenames = void 0
|
|
4
|
-
const react_1 = require(
|
|
5
|
-
const createActions_1 = require(
|
|
6
|
-
const createReducer_1 = require(
|
|
7
|
-
const createSelectors_1 = require(
|
|
8
|
-
const mutate_1 = require(
|
|
9
|
-
const query_1 = require(
|
|
10
|
-
const useMutation_1 = require(
|
|
11
|
-
const useQuery_1 = require(
|
|
12
|
-
const utilsAndConstants_1 = require(
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {value: true})
|
|
3
|
+
exports.createCache = exports.withTypenames = void 0
|
|
4
|
+
const react_1 = require('react')
|
|
5
|
+
const createActions_1 = require('./createActions')
|
|
6
|
+
const createReducer_1 = require('./createReducer')
|
|
7
|
+
const createSelectors_1 = require('./createSelectors')
|
|
8
|
+
const mutate_1 = require('./mutate')
|
|
9
|
+
const query_1 = require('./query')
|
|
10
|
+
const useMutation_1 = require('./useMutation')
|
|
11
|
+
const useQuery_1 = require('./useQuery')
|
|
12
|
+
const utilsAndConstants_1 = require('./utilsAndConstants')
|
|
13
13
|
const withTypenames = () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
14
|
+
return {
|
|
15
|
+
createCache: (partialCache) => {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
17
|
+
var _p, _q, _r, _s, _t, _u, _v
|
|
18
|
+
const abortControllers = new WeakMap()
|
|
19
|
+
;(_a = partialCache.options) !== null && _a !== void 0 ? _a : (partialCache.options = {})
|
|
20
|
+
;(_b = (_p = partialCache.options).mutableCollections) !== null && _b !== void 0
|
|
21
|
+
? _b
|
|
22
|
+
: (_p.mutableCollections = false)
|
|
23
|
+
;(_c = (_q = partialCache.options).logsEnabled) !== null && _c !== void 0
|
|
24
|
+
? _c
|
|
25
|
+
: (_q.logsEnabled = false)
|
|
26
|
+
;(_d = (_r = partialCache.options).additionalValidation) !== null && _d !== void 0
|
|
27
|
+
? _d
|
|
28
|
+
: (_r.additionalValidation = utilsAndConstants_1.IS_DEV)
|
|
29
|
+
;(_e = (_s = partialCache.options).deepComparisonEnabled) !== null && _e !== void 0
|
|
30
|
+
? _e
|
|
31
|
+
: (_s.deepComparisonEnabled = true)
|
|
32
|
+
;(_f = partialCache.globals) !== null && _f !== void 0 ? _f : (partialCache.globals = {})
|
|
33
|
+
;(_g = (_t = partialCache.globals).queries) !== null && _g !== void 0 ? _g : (_t.queries = {})
|
|
34
|
+
;(_h = (_u = partialCache.globals.queries).fetchPolicy) !== null && _h !== void 0
|
|
35
|
+
? _h
|
|
36
|
+
: (_u.fetchPolicy = utilsAndConstants_1.FetchPolicy.NoCacheOrExpired)
|
|
37
|
+
;(_j = (_v = partialCache.globals.queries).skipFetch) !== null && _j !== void 0
|
|
38
|
+
? _j
|
|
39
|
+
: (_v.skipFetch = false)
|
|
40
|
+
;(_k = partialCache.cacheStateSelector) !== null && _k !== void 0
|
|
41
|
+
? _k
|
|
42
|
+
: (partialCache.cacheStateSelector = (state) => state[cache.name])
|
|
43
|
+
;(_l = partialCache.mutations) !== null && _l !== void 0 ? _l : (partialCache.mutations = {})
|
|
44
|
+
;(_m = partialCache.queries) !== null && _m !== void 0 ? _m : (partialCache.queries = {})
|
|
45
|
+
partialCache.abortControllers = abortControllers
|
|
46
|
+
try {
|
|
47
|
+
;(_o = partialCache.storeHooks) !== null && _o !== void 0
|
|
48
|
+
? _o
|
|
49
|
+
: (partialCache.storeHooks = {
|
|
50
|
+
useStore: require('react-redux').useStore,
|
|
51
|
+
useSelector: require('react-redux').useSelector,
|
|
52
|
+
})
|
|
53
|
+
} catch (e) {
|
|
54
|
+
throw e
|
|
55
|
+
}
|
|
56
|
+
const cache = partialCache
|
|
57
|
+
if (cache.options.deepComparisonEnabled && !utilsAndConstants_1.optionalUtils.deepEqual) {
|
|
58
|
+
;(0, utilsAndConstants_1.logWarn)(
|
|
59
|
+
'createCache',
|
|
60
|
+
'optional dependency for fast-deep-equal was not provided, while deepComparisonEnabled option is true',
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
const setDefaultComparer = (target) => {
|
|
64
|
+
if (
|
|
65
|
+
(target === null || target === void 0 ? void 0 : target.selectorComparer) != null &&
|
|
66
|
+
typeof target.selectorComparer === 'object'
|
|
67
|
+
) {
|
|
68
|
+
target.selectorComparer = (0, utilsAndConstants_1.createStateComparer)(target.selectorComparer)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
setDefaultComparer(cache.globals.queries)
|
|
72
|
+
for (const queryKey in partialCache.queries) {
|
|
73
|
+
setDefaultComparer(partialCache.queries[queryKey])
|
|
74
|
+
}
|
|
75
|
+
const selectors = Object.assign(
|
|
76
|
+
{selectCacheState: cache.cacheStateSelector},
|
|
77
|
+
(0, createSelectors_1.createSelectors)(cache),
|
|
78
|
+
)
|
|
79
|
+
const {
|
|
80
|
+
selectCacheState,
|
|
81
|
+
selectQueryState,
|
|
82
|
+
selectQueryResult,
|
|
83
|
+
selectQueryLoading,
|
|
84
|
+
selectQueryError,
|
|
85
|
+
selectQueryParams,
|
|
86
|
+
selectQueryExpiresAt,
|
|
87
|
+
selectMutationState,
|
|
88
|
+
selectMutationResult,
|
|
89
|
+
selectMutationLoading,
|
|
90
|
+
selectMutationError,
|
|
91
|
+
selectMutationParams,
|
|
92
|
+
selectEntityById,
|
|
93
|
+
selectEntities,
|
|
94
|
+
selectEntitiesByTypename,
|
|
95
|
+
} = selectors
|
|
96
|
+
const actions = (0, createActions_1.createActions)(cache.name)
|
|
97
|
+
const {
|
|
98
|
+
updateQueryStateAndEntities,
|
|
99
|
+
updateMutationStateAndEntities,
|
|
100
|
+
mergeEntityChanges,
|
|
101
|
+
invalidateQuery,
|
|
102
|
+
clearQueryState,
|
|
103
|
+
clearMutationState,
|
|
104
|
+
clearCache,
|
|
105
|
+
} = actions
|
|
106
|
+
const reducer = (0, createReducer_1.createReducer)(actions, Object.keys(cache.queries), cache.options)
|
|
107
|
+
const createClient = (store) => {
|
|
108
|
+
const client = {
|
|
109
|
+
query: (options) => {
|
|
110
|
+
var _a
|
|
111
|
+
const {query: queryKey, params} = options
|
|
112
|
+
const getCacheKey =
|
|
113
|
+
(_a = cache.queries[queryKey].getCacheKey) !== null && _a !== void 0
|
|
114
|
+
? _a
|
|
115
|
+
: utilsAndConstants_1.defaultGetCacheKey
|
|
116
|
+
const cacheKey = getCacheKey(params)
|
|
117
|
+
return (0, query_1.query)(
|
|
118
|
+
'query',
|
|
119
|
+
store,
|
|
120
|
+
cache,
|
|
121
|
+
actions,
|
|
122
|
+
selectors,
|
|
123
|
+
queryKey,
|
|
124
|
+
cacheKey,
|
|
125
|
+
params,
|
|
126
|
+
options.secondsToLive,
|
|
127
|
+
options.onlyIfExpired,
|
|
128
|
+
options.skipFetch,
|
|
129
|
+
options.mergeResults,
|
|
130
|
+
options.onCompleted,
|
|
131
|
+
options.onSuccess,
|
|
132
|
+
options.onError,
|
|
133
|
+
)
|
|
134
|
+
},
|
|
135
|
+
mutate: (options) => {
|
|
136
|
+
return (0, mutate_1.mutate)(
|
|
137
|
+
'mutate',
|
|
138
|
+
store,
|
|
139
|
+
cache,
|
|
140
|
+
actions,
|
|
141
|
+
selectors,
|
|
142
|
+
options.mutation,
|
|
143
|
+
options.params,
|
|
144
|
+
abortControllers,
|
|
145
|
+
options.onCompleted,
|
|
146
|
+
options.onSuccess,
|
|
147
|
+
options.onError,
|
|
148
|
+
)
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
return client
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
cache,
|
|
155
|
+
reducer,
|
|
156
|
+
actions: {
|
|
157
|
+
updateQueryStateAndEntities,
|
|
158
|
+
updateMutationStateAndEntities,
|
|
159
|
+
mergeEntityChanges,
|
|
160
|
+
invalidateQuery,
|
|
161
|
+
clearQueryState,
|
|
162
|
+
clearMutationState,
|
|
163
|
+
clearCache,
|
|
164
|
+
},
|
|
165
|
+
selectors: {
|
|
166
|
+
selectCacheState,
|
|
167
|
+
selectQueryState,
|
|
168
|
+
selectQueryResult,
|
|
169
|
+
selectQueryLoading,
|
|
170
|
+
selectQueryError,
|
|
171
|
+
selectQueryParams,
|
|
172
|
+
selectQueryExpiresAt,
|
|
173
|
+
selectMutationState,
|
|
174
|
+
selectMutationResult,
|
|
175
|
+
selectMutationLoading,
|
|
176
|
+
selectMutationError,
|
|
177
|
+
selectMutationParams,
|
|
178
|
+
selectEntityById,
|
|
179
|
+
selectEntities,
|
|
180
|
+
selectEntitiesByTypename,
|
|
181
|
+
},
|
|
182
|
+
hooks: {
|
|
183
|
+
useClient: () => {
|
|
184
|
+
const store = cache.storeHooks.useStore()
|
|
185
|
+
return (0, react_1.useMemo)(() => createClient(store), [store])
|
|
186
|
+
},
|
|
187
|
+
useQuery: (options) => (0, useQuery_1.useQuery)(cache, actions, selectors, options),
|
|
188
|
+
useMutation: (options) =>
|
|
189
|
+
(0, useMutation_1.useMutation)(cache, actions, selectors, options, abortControllers),
|
|
190
|
+
useSelectEntityById: (id, typename) => {
|
|
191
|
+
return cache.storeHooks.useSelector((state) => selectEntityById(state, id, typename))
|
|
192
|
+
},
|
|
193
|
+
useEntitiesByTypename: (typename) => {
|
|
194
|
+
if (cache.options.mutableCollections) {
|
|
195
|
+
cache.storeHooks.useSelector((state) => {
|
|
196
|
+
var _a
|
|
197
|
+
return (_a = selectEntitiesByTypename(state, typename)) === null || _a === void 0
|
|
198
|
+
? void 0
|
|
199
|
+
: _a._changeKey
|
|
200
|
+
})
|
|
53
201
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const cacheKey = getCacheKey(params);
|
|
66
|
-
return (0, query_1.query)('query', store, cache, actions, selectors, queryKey, cacheKey, params, options.secondsToLive, options.onlyIfExpired, options.skipFetch, options.mergeResults, options.onCompleted, options.onSuccess, options.onError);
|
|
67
|
-
},
|
|
68
|
-
mutate: (options) => {
|
|
69
|
-
return (0, mutate_1.mutate)('mutate', store, cache, actions, selectors, options.mutation, options.params, abortControllers, options.onCompleted, options.onSuccess, options.onError);
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
return client;
|
|
73
|
-
};
|
|
74
|
-
return {
|
|
75
|
-
cache,
|
|
76
|
-
reducer,
|
|
77
|
-
actions: {
|
|
78
|
-
updateQueryStateAndEntities,
|
|
79
|
-
updateMutationStateAndEntities,
|
|
80
|
-
mergeEntityChanges,
|
|
81
|
-
invalidateQuery,
|
|
82
|
-
clearQueryState,
|
|
83
|
-
clearMutationState,
|
|
84
|
-
clearCache,
|
|
85
|
-
},
|
|
86
|
-
selectors: {
|
|
87
|
-
selectCacheState,
|
|
88
|
-
selectQueryState,
|
|
89
|
-
selectQueryResult,
|
|
90
|
-
selectQueryLoading,
|
|
91
|
-
selectQueryError,
|
|
92
|
-
selectQueryParams,
|
|
93
|
-
selectQueryExpiresAt,
|
|
94
|
-
selectMutationState,
|
|
95
|
-
selectMutationResult,
|
|
96
|
-
selectMutationLoading,
|
|
97
|
-
selectMutationError,
|
|
98
|
-
selectMutationParams,
|
|
99
|
-
selectEntityById,
|
|
100
|
-
selectEntities,
|
|
101
|
-
selectEntitiesByTypename,
|
|
102
|
-
},
|
|
103
|
-
hooks: {
|
|
104
|
-
useClient: () => {
|
|
105
|
-
const store = cache.storeHooks.useStore();
|
|
106
|
-
return (0, react_1.useMemo)(() => createClient(store), [store]);
|
|
107
|
-
},
|
|
108
|
-
useQuery: (options) => (0, useQuery_1.useQuery)(cache, actions, selectors, options),
|
|
109
|
-
useMutation: (options) => (0, useMutation_1.useMutation)(cache, actions, selectors, options, abortControllers),
|
|
110
|
-
useSelectEntityById: (id, typename) => {
|
|
111
|
-
return cache.storeHooks.useSelector((state) => selectEntityById(state, id, typename));
|
|
112
|
-
},
|
|
113
|
-
useEntitiesByTypename: (typename) => {
|
|
114
|
-
if (cache.options.mutableCollections) {
|
|
115
|
-
cache.storeHooks.useSelector((state) => { var _a; return (_a = selectEntitiesByTypename(state, typename)) === null || _a === void 0 ? void 0 : _a._changeKey; });
|
|
116
|
-
}
|
|
117
|
-
return cache.storeHooks.useSelector((state) => selectEntitiesByTypename(state, typename));
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
utils: {
|
|
121
|
-
createClient,
|
|
122
|
-
getInitialState: () => {
|
|
123
|
-
return reducer(undefined, utilsAndConstants_1.EMPTY_OBJECT);
|
|
124
|
-
},
|
|
125
|
-
applyEntityChanges: (entities, changes) => {
|
|
126
|
-
return (0, utilsAndConstants_1.applyEntityChanges)(entities, changes, cache.options);
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
};
|
|
202
|
+
return cache.storeHooks.useSelector((state) => selectEntitiesByTypename(state, typename))
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
utils: {
|
|
206
|
+
createClient,
|
|
207
|
+
getInitialState: () => {
|
|
208
|
+
return reducer(undefined, utilsAndConstants_1.EMPTY_OBJECT)
|
|
209
|
+
},
|
|
210
|
+
applyEntityChanges: (entities, changes) => {
|
|
211
|
+
return (0, utilsAndConstants_1.applyEntityChanges)(entities, changes, cache.options)
|
|
212
|
+
},
|
|
130
213
|
},
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.withTypenames = withTypenames
|
|
219
|
+
exports.createCache = (0, exports.withTypenames)().createCache
|