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.
Files changed (2) hide show
  1. package/lib/resourcerer.js +11 -4
  2. package/package.json +1 -1
@@ -212,10 +212,17 @@ export const useResources = (getResources, props) => {
212
212
  });
213
213
  });
214
214
  },
215
- onRequestFailure: (status, [name, config]) => loaderDispatch({
216
- type: LoadingStates.ERROR,
217
- payload: {name, config, status}
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resourcerer",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "repository": "github.com/noahgrant/resourcerer",
5
5
  "description": "Declarative data-fetching and caching framework for React",
6
6
  "keywords": [