Adds reducer method for storing needs that have failed to load
@@ -67,6 +67,7 @@ export function addNeedInLoading(needs, needUri, state, isOwned) {
uri: needUri,
toLoad: false,
isLoading: true,
+ failedToLoad: false,
isOwned: isOwned,
state: state,
connections: Immutable.Map(),
@@ -84,6 +85,7 @@ export function addTheirNeedInLoading(needs, needUri) {
uri: needUri,
toLoad: false,
isLoading: true,
+ failedToLoad: false,
isOwned: false,
connections: Immutable.Map(),
});
@@ -91,6 +93,17 @@ export function addTheirNeedInLoading(needs, needUri) {
}
}
+export function addFailedToStore(needs, needUri) {
+ const oldNeed = needs.get(needUri);
+ if (oldNeed) {
+ return needs
+ .setIn([needUri, "isLoading"], false)
+ .setIn([needUri, "toLoad"], false)
+ .setIn([needUri, "failedToLoad"], true);
+ }
+ return needs;
+}
+
export function addOwnActiveNeedsInLoading(needs, needUris) {
needUris &&
needUris.size > 0 &&
@@ -163,6 +176,7 @@ export function addNeedToLoad(needs, needUri, state, isOwned) {
uri: needUri,
toLoad: true,
isLoading: false,
+ failedToLoad: false,
isOwned: isOwned,
state: state,
connections: Immutable.Map(),
