Skip to content

Commit

Permalink
fix processes async requests (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Aug 27, 2021
1 parent 4fc5e28 commit 437b5eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion geonode_mapstore_client/client/js/epics/resourceservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const processAPI = {

export const gnProcessResources = (action$) =>
action$.ofType(PROCESS_RESOURCES)
.switchMap((action) => {
// all the processes must be listened for this reason we should use flatMap instead of switchMap
.flatMap((action) => {
return Observable.defer(() => axios.all(
action.resources.map(resource =>
processAPI[action.processType](resource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const LOCAL_STORAGE_PROCESSES_KEY = 'gn.reducers.resourceservice.processes';
export function getLocalStorageProcesses() {
try {
const processes = JSON.parse(localStorage.getItem(LOCAL_STORAGE_PROCESSES_KEY)) || [];
return processes.filter(({ completed, output }) => !(completed || output?.status === ProcessStatus.FINISHED || output?.status === ProcessStatus.FAILED));
return processes.filter(({ completed, output }) => !(completed || !output || output?.status === ProcessStatus.FINISHED || output?.status === ProcessStatus.FAILED));
} catch (e) {
return [];
}
Expand Down

0 comments on commit 437b5eb

Please sign in to comment.