resourcerer 1.0.4 → 1.0.5
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/lib/resourcerer.js +7 -3
- package/package.json +1 -1
package/lib/resourcerer.js
CHANGED
|
@@ -101,17 +101,21 @@ export const useResources = (getResources, props) => {
|
|
|
101
101
|
listenedModelsRef = useRef([]),
|
|
102
102
|
|
|
103
103
|
forceUpdate = useForceUpdate(),
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
// note that this only tells when cache keys have changed. if a resource has already been
|
|
106
106
|
// cached, this will still return its resource when the component mounts. that's why we
|
|
107
107
|
// partition these out later into loaded and not loaded resources
|
|
108
108
|
getResourcesToUpdate = (rsrcs) => rsrcs.filter(hasAllDependencies.bind(null, props))
|
|
109
109
|
.filter(not(shouldBypassFetch.bind(null, props)))
|
|
110
110
|
.filter(([name, config]) => {
|
|
111
|
-
var
|
|
111
|
+
var prevConfig = findConfig([name, config], getResources, prevPropsRef.current || {}),
|
|
112
|
+
previousCacheKey = prevPropsRef.current && getCacheKey(prevConfig);
|
|
112
113
|
|
|
113
114
|
return (!previousCacheKey || previousCacheKey !== getCacheKey(config) ||
|
|
114
|
-
!hasAllDependencies(prevPropsRef.current, [, config]) || config.refetch
|
|
115
|
+
!hasAllDependencies(prevPropsRef.current, [, config]) || config.refetch ||
|
|
116
|
+
// make sure if we were lazy and are no longer lazy (from the same component) that we
|
|
117
|
+
// get included in the list to get updated
|
|
118
|
+
(prevConfig.lazy && !config.lazy));
|
|
115
119
|
});
|
|
116
120
|
|
|
117
121
|
/**
|