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 { ...@@ -270,7 +270,7 @@ export default {
) )
)(accountId, folderId, query) )(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) const folder = getters.getFolder(accountId, folderId)
if (folder.isUnified) { if (folder.isUnified) {
...@@ -308,10 +308,9 @@ export default { ...@@ -308,10 +308,9 @@ export default {
findIndividualFolders(getters.getFolders, folder.specialRole), findIndividualFolders(getters.getFolders, folder.specialRole),
filter(needsFetch(query, nextLocalUnifiedEnvelopePage(accounts))) filter(needsFetch(query, nextLocalUnifiedEnvelopePage(accounts)))
)(accounts) )(accounts)
const fs = foldersToFetch(getters.accounts) const fs = foldersToFetch(getters.accounts)
if (fs.length) { if (rec && fs.length) {
return pipe( return pipe(
map((f) => map((f) =>
dispatch('fetchNextEnvelopePage', { dispatch('fetchNextEnvelopePage', {
...@@ -326,6 +325,7 @@ export default { ...@@ -326,6 +325,7 @@ export default {
accountId, accountId,
folderId, folderId,
query, query,
rec: false,
}) })
) )
)(fs) )(fs)
...@@ -355,6 +355,7 @@ export default { ...@@ -355,6 +355,7 @@ export default {
} }
return fetchEnvelopes(accountId, folderId, query, lastEnvelope.dateInt).then((envelopes) => { 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) => envelopes.forEach((envelope) =>
commit('addEnvelope', { commit('addEnvelope', {
accountId, 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