Skip to content
Snippets Groups Projects
Unverified Commit 8b395617 authored by Christoph Wurst's avatar Christoph Wurst Committed by GitHub
Browse files

Merge pull request #2914 from nextcloud/fix/fetch-more-break-recursion

Break the recursion when fetching the next page
parents d13982cd c851481c
No related branches found
No related tags found
No related merge requests found
......@@ -270,7 +270,7 @@ export default {
)
)(accountId, folderId, query)
},
fetchNextEnvelopePage({commit, getters, dispatch}, {accountId, folderId, query}) {
fetchNextEnvelopePage({commit, getters, dispatch}, {accountId, folderId, query, rec = true}) {
const folder = getters.getFolder(accountId, folderId)
if (folder.isUnified) {
......@@ -308,10 +308,9 @@ export default {
findIndividualFolders(getters.getFolders, folder.specialRole),
filter(needsFetch(query, nextLocalUnifiedEnvelopePage(accounts)))
)(accounts)
const fs = foldersToFetch(getters.accounts)
if (fs.length) {
if (rec && fs.length) {
return pipe(
map((f) =>
dispatch('fetchNextEnvelopePage', {
......@@ -326,6 +325,7 @@ export default {
accountId,
folderId,
query,
rec: false,
})
)
)(fs)
......@@ -355,6 +355,7 @@ export default {
}
return fetchEnvelopes(accountId, folderId, query, lastEnvelope.dateInt).then((envelopes) => {
logger.debug(`fetched ${envelopes.length} messages for the next page of ${accountId}:${folderId}`)
envelopes.forEach((envelope) =>
commit('addEnvelope', {
accountId,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment