Fix batch resolve
This commit is contained in:
parent
7c3cbaca15
commit
c4a23ff856
1 changed files with 22 additions and 20 deletions
|
@ -65,32 +65,34 @@ export function doCommentList(
|
||||||
const { items: comments, total_items, total_filtered_items, total_pages } = result;
|
const { items: comments, total_items, total_filtered_items, total_pages } = result;
|
||||||
|
|
||||||
const commentChannelUrls = comments && comments.map((comment) => comment.channel_url || '');
|
const commentChannelUrls = comments && comments.map((comment) => comment.channel_url || '');
|
||||||
const dispatchData = {
|
|
||||||
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
const returnResult = () => {
|
||||||
data: {
|
dispatch({
|
||||||
comments,
|
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
||||||
parentId,
|
data: {
|
||||||
totalItems: total_items,
|
comments,
|
||||||
totalFilteredItems: total_filtered_items,
|
parentId,
|
||||||
totalPages: total_pages,
|
totalItems: total_items,
|
||||||
claimId,
|
totalFilteredItems: total_filtered_items,
|
||||||
creatorClaimId,
|
totalPages: total_pages,
|
||||||
uri,
|
claimId,
|
||||||
},
|
creatorClaimId,
|
||||||
|
uri,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Batch resolve comment channel urls
|
// Batch resolve comment channel urls
|
||||||
if (commentChannelUrls) {
|
if (commentChannelUrls) {
|
||||||
return dispatch(async () => await doResolveUris(commentChannelUrls, true)).then(() => {
|
const resolve = async () => await doResolveUris(commentChannelUrls, true);
|
||||||
dispatch({ ...dispatchData });
|
|
||||||
|
|
||||||
return result;
|
return resolve()
|
||||||
});
|
.then(() => dispatch(doResolveUris(commentChannelUrls, true)).then(() => returnResult()))
|
||||||
} else {
|
.catch(() => returnResult());
|
||||||
dispatch({ ...dispatchData });
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnResult();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const { message } = error;
|
const { message } = error;
|
||||||
|
|
Loading…
Reference in a new issue