resourcerer 1.0.9 → 1.0.10
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 +11 -4
- package/package.json +1 -1
package/lib/resourcerer.js
CHANGED
|
@@ -212,10 +212,17 @@ export const useResources = (getResources, props) => {
|
|
|
212
212
|
});
|
|
213
213
|
});
|
|
214
214
|
},
|
|
215
|
-
onRequestFailure: (status, [name, config]) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
onRequestFailure: (status, [name, config]) => {
|
|
216
|
+
// request failed, which means this model should not be in the cache. but we still want to
|
|
217
|
+
// set our model state so that when we go back into a loading state, the empty model
|
|
218
|
+
// is present instead of any previously-loaded model
|
|
219
|
+
setModels(modelAggregator([[name, config]]));
|
|
220
|
+
|
|
221
|
+
loaderDispatch({
|
|
222
|
+
type: LoadingStates.ERROR,
|
|
223
|
+
payload: {name, config, status}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
219
226
|
}).then(() => {
|
|
220
227
|
if (isMountedRef.current) {
|
|
221
228
|
// only get those from the cache. models in state might can empty models, but even so i
|