0
0
Fork 0

Fix direct timeline pagination in the WebUI (#10126)

The `hasMore` property of timelines in redux store was set whenever an API
request returned only one page of results, *even* if the query only requested
newer conversations (using `since_id`), causing `hasMore` to be incorrectly set to
false whenever fetching new toots in the direct timeline, which happens each time
the direct message column is opened.

(Basically #9516 for direct messages)
This commit is contained in:
ThibG 2019-02-27 19:13:16 +01:00 committed by Eugen Rochko
parent df01206703
commit 6e8743d17a
2 changed files with 8 additions and 5 deletions

View file

@ -35,7 +35,7 @@ const updateConversation = (state, item) => state.update('items', list => {
}
});
const expandNormalizedConversations = (state, conversations, next) => {
const expandNormalizedConversations = (state, conversations, next, isLoadingRecent) => {
let items = ImmutableList(conversations.map(conversationToMap));
return state.withMutations(mutable => {
@ -66,7 +66,7 @@ const expandNormalizedConversations = (state, conversations, next) => {
});
}
if (!next) {
if (!next && !isLoadingRecent) {
mutable.set('hasMore', false);
}
@ -81,7 +81,7 @@ export default function conversations(state = initialState, action) {
case CONVERSATIONS_FETCH_FAIL:
return state.set('isLoading', false);
case CONVERSATIONS_FETCH_SUCCESS:
return expandNormalizedConversations(state, action.conversations, action.next);
return expandNormalizedConversations(state, action.conversations, action.next, action.isLoadingRecent);
case CONVERSATIONS_UPDATE:
return updateConversation(state, action.conversation);
case CONVERSATIONS_MOUNT: