about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/timelines.js
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2018-04-18 23:50:19 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-04-18 16:50:19 +0200
commit0ba49eca8b49c6ce0ec04fd546951c95938da4e6 (patch)
treeb5dd6e79ed19575d2767aa76c367825780ce0528 /app/javascript/mastodon/reducers/timelines.js
parent7162a28c34868eb4b8cdd23a4078d99b46949491 (diff)
Fix comparing id (#7180)
Diffstat (limited to 'app/javascript/mastodon/reducers/timelines.js')
-rw-r--r--app/javascript/mastodon/reducers/timelines.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/mastodon/reducers/timelines.js
index f795e7e08..ad897bcc9 100644
--- a/app/javascript/mastodon/reducers/timelines.js
+++ b/app/javascript/mastodon/reducers/timelines.js
@@ -13,6 +13,7 @@ import {
   ACCOUNT_UNFOLLOW_SUCCESS,
 } from '../actions/accounts';
 import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
+import compareId from '../compare_id';
 
 const initialState = ImmutableMap();
 
@@ -32,8 +33,8 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial) =>
     if (!statuses.isEmpty()) {
       mMap.update('items', ImmutableList(), oldIds => {
         const newIds = statuses.map(status => status.get('id'));
-        const lastIndex = oldIds.findLastIndex(id => id !== null && id >= newIds.last()) + 1;
-        const firstIndex = oldIds.take(lastIndex).findLastIndex(id => id !== null && id > newIds.first());
+        const lastIndex = oldIds.findLastIndex(id => id !== null && compareId(id, newIds.last()) >= 0) + 1;
+        const firstIndex = oldIds.take(lastIndex).findLastIndex(id => id !== null && compareId(id, newIds.first()) >= 0);
 
         if (firstIndex < 0) {
           return (isPartial ? newIds.unshift(null) : newIds).concat(oldIds.skip(lastIndex));