|
1 |
| -import scuttlebutt, { |
2 |
| - isGossipType, sortUpdate, UPDATE_ACTION, UPDATE_TIMESTAMP |
3 |
| -} from 'redux-scuttlebutt' |
| 1 | +// import scuttlebutt, { |
| 2 | +// isGossipType, sortUpdate, UPDATE_ACTION, UPDATE_TIMESTAMP |
| 3 | +// } from 'redux-scuttlebutt' |
4 | 4 |
|
5 |
| -import { RESET, RANDOM } from '../constants/ActionTypes' |
| 5 | +const scuttlebutt = require('redux-scuttlebutt'), |
| 6 | + isGossipType = scuttlebutt.isGossipType, |
| 7 | + sortUpdate = scuttlebutt.sortUpdate, |
| 8 | + UPDATE_ACTION = scuttlebutt.UPDATE_ACTION, |
| 9 | + UPDATE_TIMESTAMP = scuttlebutt.UPDATE_TIMESTAMP |
6 | 10 |
|
7 |
| -export default function getFilterHistory() { |
8 |
| - var lastReset = [, -Infinity] |
| 11 | +// import { RESET, RANDOM } from '../constants/ActionTypes' |
| 12 | +const RESET = 'RESET', RANDOM = 'RANDOM' |
| 13 | + |
| 14 | +// old-school exports so we can require it in browser or in node |
| 15 | +var exports = module.exports = {}; |
| 16 | +exports.getFilterHistory = function getFilterHistory() { |
| 17 | + var lastReset = [0, 0] |
9 | 18 |
|
10 | 19 | return function filterHistory(update, index, state) {
|
11 | 20 | // if update is less than reset, and it's not the root action
|
12 | 21 | if (update !== lastReset
|
| 22 | + && update[UPDATE_TIMESTAMP] // don't trim bedrock values |
| 23 | + && update[UPDATE_TIMESTAMP] !== lastReset[UPDATE_TIMESTAMP] // don't trim the reset |
13 | 24 | && sortUpdate(update, lastReset) < 0
|
14 |
| - && update[UPDATE_TIMESTAMP] |
15 | 25 | ) {
|
16 | 26 | return false
|
17 | 27 | }
|
|
0 commit comments