]> cat aescling's git repositories - mastodon.git/commitdiff
Fix load more on account timelines (regression from #3311) (#3475)
authorunarist <m.unarist@gmail.com>
Wed, 31 May 2017 13:30:26 +0000 (22:30 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 31 May 2017 13:30:26 +0000 (15:30 +0200)
This prevents `next` state from being overridden on the loading *new* statuses.

app/javascript/mastodon/actions/accounts.js
app/javascript/mastodon/reducers/timelines.js

index 48ab7b6ede8023aa8e42c1159e6a02fb9b678c7b..4050324607064ee33d7d680885a83bfd59b36c29 100644 (file)
@@ -107,7 +107,9 @@ export function fetchAccountTimeline(id, replace = false) {
     let params = {};
     let skipLoading = false;
 
-    if (newestId !== null && !replace) {
+    replace = replace || newestId === null;
+
+    if (!replace) {
       params.since_id = newestId;
       skipLoading = true;
     }
@@ -131,7 +133,9 @@ export function fetchAccountMediaTimeline(id, replace = false) {
     let params = { only_media: 'true', limit: 12 };
     let skipLoading = false;
 
-    if (newestId !== null && !replace) {
+    replace = replace || newestId === null;
+
+    if (!replace) {
       params.since_id = newestId;
       skipLoading = true;
     }
index 0087a06ce4371ea47d2f363ec00b469039a3312c..ab756b854616ac881f2532a3730019f8b0b6044e 100644 (file)
@@ -138,7 +138,7 @@ const normalizeAccountTimeline = (state, accountId, statuses, replace, next) =>
   return state.updateIn(['accounts_timelines', accountId], Immutable.Map(), map => map
     .set('isLoading', false)
     .set('loaded', true)
-    .set('next', next)
+    .update('next', null, v => replace ? next : v)
     .update('items', Immutable.List(), list => (replace ? ids : ids.concat(list))));
 };
 
@@ -152,7 +152,7 @@ const normalizeAccountMediaTimeline = (state, accountId, statuses, replace, next
 
   return state.updateIn(['accounts_media_timelines', accountId], Immutable.Map(), map => map
     .set('isLoading', false)
-    .set('next', next)
+    .update('next', null, v => replace ? next : v)
     .update('items', Immutable.List(), list => (replace ? ids : ids.concat(list))));
 };