about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions/timelines.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-03-01 01:43:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-03-01 01:43:29 +0100
commitfbdb3bcf1ede96d97693165c485f1eabc44b9f8b (patch)
tree7df5d7bd6804be4e2336e1edaa4625c5f54354ee /app/assets/javascripts/components/actions/timelines.jsx
parente1b00757a69ff1cb49311addb7aa76650d680e43 (diff)
Revert infinite scroll in timelines back to looking at ID of oldest
loaded status; do not preload submitted statuses into community/public
timelines, unless those timelines have already been loaded; do not
close streaming API connections for community/public timelines, once
they have been established (most users navigate back to them eventually)
Diffstat (limited to 'app/assets/javascripts/components/actions/timelines.jsx')
-rw-r--r--app/assets/javascripts/components/actions/timelines.jsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx
index 311b08033..3e2d4ff43 100644
--- a/app/assets/javascripts/components/actions/timelines.jsx
+++ b/app/assets/javascripts/components/actions/timelines.jsx
@@ -106,18 +106,20 @@ export function expandTimeline(timeline) {
       return;
     }
 
-    const next   = getState().getIn(['timelines', timeline, 'next']);
-    const params = getState().getIn(['timelines', timeline, 'params'], {});
-
-    if (next === null) {
+    if (getState().getIn(['timelines', timeline, 'items']).size === 0) {
       return;
     }
 
+    const path   = getState().getIn(['timelines', timeline, 'path'])(getState().getIn(['timelines', timeline, 'id']));
+    const params = getState().getIn(['timelines', timeline, 'params'], {});
+    const lastId = getState().getIn(['timelines', timeline, 'items']).last();
+
     dispatch(expandTimelineRequest(timeline));
 
-    api(getState).get(next, {
+    api(getState).get(path, {
       params: {
         ...params,
+        max_id: lastId,
         limit: 10
       }
     }).then(response => {