Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Commit

Permalink
Compare tweet ids with bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed May 26, 2018
1 parent 9c1b89c commit aa3bcfa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"dependencies": {
"autolinker": "^0.19.0",
"big-integer": "^1.6.28",
"moment": "^2.11.2",
"node-twitter-api": "^1.6.0",
"react": "^0.14.7",
Expand Down
3 changes: 2 additions & 1 deletion src/reducers/tabs-by-user-id.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Actions from '../actions';
import bigInt from 'big-integer';

const MAX_TWEETS_FOR_EACH_TAB = 100;

// Return set order by id DESC.
const sortedAdd = (set, tweet) => {
for (let i in set) {
let result = set[i].id_str.localeCompare(tweet.id_str);
let result = bigInt(set[i].id_str).compare(bigInt(tweet.id_str));
if (result == -1) {
// If set[i].id_str is smaller than tweet.id_str, prepend tweet to set[i].
return [...set.slice(0, i), tweet, ...set.slice(i)];
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ beeper@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809"

big-integer@^1.6.28:
version "1.6.28"
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.28.tgz#8cef0fda3ccde8759c2c66efcfacc35aea658283"

binary@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79"
Expand Down

0 comments on commit aa3bcfa

Please sign in to comment.