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-04-02 21:44:06 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-02 21:44:06 +0200
commitaaa4d1b0fb896f0d5f607cca3760106399caf41b (patch)
treeedc656f128443bc6ac8400e88e7267a1f3098554 /app/assets/javascripts/components/actions/timelines.jsx
parent3618cc04ffc33e434b18ef6cee2a5ef79273bf7f (diff)
Keep track of which timelines are connected live to avoid redundant
refreshes on navigation
Diffstat (limited to 'app/assets/javascripts/components/actions/timelines.jsx')
-rw-r--r--app/assets/javascripts/components/actions/timelines.jsx22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx
index 3e2d4ff43..6cd1f04b3 100644
--- a/app/assets/javascripts/components/actions/timelines.jsx
+++ b/app/assets/javascripts/components/actions/timelines.jsx
@@ -14,6 +14,9 @@ export const TIMELINE_EXPAND_FAIL    = 'TIMELINE_EXPAND_FAIL';
 
 export const TIMELINE_SCROLL_TOP = 'TIMELINE_SCROLL_TOP';
 
+export const TIMELINE_CONNECT    = 'TIMELINE_CONNECT';
+export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
+
 export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) {
   return {
     type: TIMELINE_REFRESH_SUCCESS,
@@ -76,6 +79,11 @@ export function refreshTimeline(timeline, id = null) {
     let skipLoading = false;
 
     if (newestId !== null && getState().getIn(['timelines', timeline, 'loaded']) && (id === null || getState().getIn(['timelines', timeline, 'id']) === id)) {
+      if (id === null && getState().getIn(['timelines', timeline, 'online'])) {
+        // Skip refreshing when timeline is live anyway
+        return;
+      }
+
       params          = { ...params, since_id: newestId };
       skipLoading     = true;
     }
@@ -162,3 +170,17 @@ export function scrollTopTimeline(timeline, top) {
     top
   };
 };
+
+export function connectTimeline(timeline) {
+  return {
+    type: TIMELINE_CONNECT,
+    timeline
+  };
+};
+
+export function disconnectTimeline(timeline) {
+  return {
+    type: TIMELINE_DISCONNECT,
+    timeline
+  };
+};