diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 6604bcb..793c5de 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -3652,14 +3652,19 @@ reducers[CLAIM_SEARCH_BY_TAGS_STARTED] = (state, action) => { reducers[CLAIM_SEARCH_BY_TAGS_COMPLETED] = (state, action) => { const fetchingClaimSearchByTags = Object.assign({}, state.fetchingClaimSearchByTags); const claimSearchUrisByTags = Object.assign({}, state.claimSearchUrisByTags); - const { tags, uris } = action.data; + const { append, tags, uris } = action.data; - // TODO: append? - claimSearchUrisByTags[tags] = uris; + let newClaimSearchUrisByTags = []; + if (action.data.append) { + // todo: check for duplicate uris when concatenating? + newClaimSearchUrisByTags = claimSearchUrisByTags.concat(uris); + } else { + newClaimSearchUrisByTags = uris; + } fetchingClaimSearchByTags[tags] = false; // or delete the key instead? return Object.assign({}, state, { - claimSearchUrisByTags, + claimSearchUrisByTags: newClaimSearchUrisByTags, fetchingClaimSearchByTags }); }; diff --git a/src/redux/reducers/claims.js b/src/redux/reducers/claims.js index e6e7794..538e028 100644 --- a/src/redux/reducers/claims.js +++ b/src/redux/reducers/claims.js @@ -327,14 +327,19 @@ reducers[ACTIONS.CLAIM_SEARCH_BY_TAGS_STARTED] = (state: State, action: any): St reducers[ACTIONS.CLAIM_SEARCH_BY_TAGS_COMPLETED] = (state: State, action: any): State => { const fetchingClaimSearchByTags = Object.assign({}, state.fetchingClaimSearchByTags); const claimSearchUrisByTags = Object.assign({}, state.claimSearchUrisByTags); - const { tags, uris } = action.data; + const { append, tags, uris } = action.data; - // TODO: append? - claimSearchUrisByTags[tags] = uris; + let newClaimSearchUrisByTags = []; + if (action.data.append) { + // todo: check for duplicate uris when concatenating? + newClaimSearchUrisByTags = claimSearchUrisByTags.concat(uris); + } else { + newClaimSearchUrisByTags = uris; + } fetchingClaimSearchByTags[tags] = false; // or delete the key instead? return Object.assign({}, state, { - claimSearchUrisByTags, + claimSearchUrisByTags: newClaimSearchUrisByTags, fetchingClaimSearchByTags, }); };