Remove fetching status from the store.

This was causing constant invalidations and therefore killing our performance.
master
Tom Hacohen 7 years ago
parent e58ddf8545
commit e38409203c

@ -29,7 +29,6 @@ function fetchTypeRecord<T>() {
return Record<FetchTypeInterface<T>>({
value: null as T | null,
error: undefined,
fetching: undefined,
});
}
@ -70,13 +69,12 @@ function fetchTypeIdentityReducer(
if (action.error) {
return state.set('error', action.payload);
} else {
const fetching = (action.payload === undefined) ? true : undefined;
const payload = (action.payload === undefined) ? null : action.payload;
state = state.set('error', undefined);
if (fetching) {
return state.set('fetching', fetching);
if (action.payload === undefined) {
return state;
}
let value = state.get('value', null);
@ -89,10 +87,7 @@ function fetchTypeIdentityReducer(
} else {
value = null;
}
return state.merge({
value,
fetching,
});
return state.set('value', value);
}
}

Loading…
Cancel
Save