Skip to content

Commit 595baff

Browse files
committed
filter history
1 parent 696346d commit 595baff

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

devServer.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ const config = (
88
: require('./webpack.config.prod')
99
)
1010

11-
1211
const dispatcher = require('redux-scuttlebutt/lib/server').default
13-
const getFilterHistory = require('./src/store/getFilterHistory.es5')
12+
const getFilterHistory = require('./src/store/getFilterHistory').getFilterHistory
1413

1514
const app = express()
1615
const server = http.Server(app)

index.html

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css"/>
1010
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/slate/bootstrap.min.css" />
1111
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
12-
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.min.css" />
1312

1413
<!-- le inline styles -->
1514
<style>

src/store/configureStore.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createStore, applyMiddleware, compose } from 'redux'
33
import rootReducer from '../reducers'
44
import scuttlebutt from 'redux-scuttlebutt'
55

6-
import getFilterHistory from './getFilterHistory'
6+
import { getFilterHistory } from './getFilterHistory'
77

88
export default (initialState) => {
99
const store = createStore(rootReducer, initialState,

src/store/getFilterHistory.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
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'
44

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
610

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]
918

1019
return function filterHistory(update, index, state) {
1120
// if update is less than reset, and it's not the root action
1221
if (update !== lastReset
22+
&& update[UPDATE_TIMESTAMP] // don't trim bedrock values
23+
&& update[UPDATE_TIMESTAMP] !== lastReset[UPDATE_TIMESTAMP] // don't trim the reset
1324
&& sortUpdate(update, lastReset) < 0
14-
&& update[UPDATE_TIMESTAMP]
1525
) {
1626
return false
1727
}

webpack.config.dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path')
22
const webpack = require('webpack')
33

44
module.exports = {
5-
devtool: 'cheap-module-eval-source-map',
5+
devtool: 'eval-source-map',
66
entry: [
77
'eventsource-polyfill', // necessary for hot reloading with IE
88
'webpack-hot-middleware/client',

0 commit comments

Comments
 (0)