resourcerer 1.0.10 → 1.0.12
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 +12 -10
- package/package.json +3 -3
package/lib/resourcerer.js
CHANGED
|
@@ -115,8 +115,8 @@ export const useResources = (getResources, props) => {
|
|
|
115
115
|
return (!previousCacheKey || previousCacheKey !== getCacheKey(config) ||
|
|
116
116
|
!hasAllDependencies(prevPropsRef.current, [, config]) || config.refetch ||
|
|
117
117
|
// make sure if we were lazy and are no longer lazy (from the same component) that we
|
|
118
|
-
// get included in the list to get updated
|
|
119
|
-
(prevConfig?.lazy
|
|
118
|
+
// get included in the list to get updated (and vice versa)
|
|
119
|
+
(prevConfig?.lazy !== config.lazy));
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -213,14 +213,16 @@ export const useResources = (getResources, props) => {
|
|
|
213
213
|
});
|
|
214
214
|
},
|
|
215
215
|
onRequestFailure: (status, [name, config]) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
ReactDOM.unstable_batchedUpdates(() => {
|
|
217
|
+
// request failed, which means this model should not be in the cache. but we still want
|
|
218
|
+
// to // set our model state so that when we go back into a loading state, the empty
|
|
219
|
+
// model is present instead of any previously-loaded model
|
|
220
|
+
setModels(modelAggregator([[name, config]]));
|
|
221
|
+
|
|
222
|
+
loaderDispatch({
|
|
223
|
+
type: LoadingStates.ERROR,
|
|
224
|
+
payload: {name, config, status}
|
|
225
|
+
});
|
|
224
226
|
});
|
|
225
227
|
}
|
|
226
228
|
}).then(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resourcerer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"repository": "github.com/noahgrant/resourcerer",
|
|
5
5
|
"description": "Declarative data-fetching and caching framework for React",
|
|
6
6
|
"keywords": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"whatwg-fetch": "^3.6.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"react": "^16.14.0 || ^17.0.0",
|
|
58
|
-
"react-dom": "^16.14.0 || ^17.0.0"
|
|
57
|
+
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
|
58
|
+
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
|
|
59
59
|
}
|
|
60
60
|
}
|