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.
@@ -101,17 +101,21 @@ export const useResources = (getResources, props) => {
101
101
  listenedModelsRef = useRef([]),
102
102
 
103
103
  forceUpdate = useForceUpdate(),
104
- getPrevCacheKey = (rsrc) => findCacheKey(rsrc, getResources, prevPropsRef.current),
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 previousCacheKey = prevPropsRef.current && getPrevCacheKey([name, config]);
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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resourcerer",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "repository": "github.com/noahgrant/resourcerer",
5
5
  "description": "Declarative data-fetching and caching framework for React",
6
6
  "keywords": [