add reselect

This commit is contained in:
Barry Gitarts 2018-12-17 15:45:45 -05:00
parent 4b0ad681e8
commit 29679a256b
5 changed files with 17 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { uniq, isNil } from 'ramda'
import { toEther } from '../utils/conversions' import { toEther } from '../utils/conversions'
import { getTokenLabel } from '../utils/currencies' import { getTokenLabel } from '../utils/currencies'
import { FundingContext } from '../context' import { FundingContext } from '../context'
import { getAuthorizations } from '../selectors/vault'
Cytoscape.use(dagre) Cytoscape.use(dagre)
@ -35,7 +36,6 @@ const stylesheet = [
} }
] ]
const getAuthorizations = events => events.filter(event => event.event === 'AuthorizePayment')
const createElements = (transfers, vaultEvents) => { const createElements = (transfers, vaultEvents) => {
if (isNil(transfers) || isNil(vaultEvents)) return [] if (isNil(transfers) || isNil(vaultEvents)) return []
const nodes = [] const nodes = []

View File

@ -0,0 +1,3 @@
import { createSelector } from 'reselect'
export const getDeposits = createSelector()

6
app/selectors/vault.js Normal file
View File

@ -0,0 +1,6 @@
import { createSelector } from 'reselect'
export const getAuthorizations = createSelector(
[vaultEvents => vaultEvents.filter(event => event.event === 'AuthorizePayment')],
event => event
)

View File

@ -72,6 +72,7 @@
"react-chartjs-2": "^2.7.4", "react-chartjs-2": "^2.7.4",
"react-cytoscapejs": "^1.1.0", "react-cytoscapejs": "^1.1.0",
"react-dom": "^16.6.3", "react-dom": "^16.6.3",
"react-router-dom": "^4.3.1" "react-router-dom": "^4.3.1",
"reselect": "^4.0.0"
} }
} }

View File

@ -6142,6 +6142,11 @@ require-uncached@^1.0.3:
caller-path "^0.1.0" caller-path "^0.1.0"
resolve-from "^1.0.0" resolve-from "^1.0.0"
reselect@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7"
integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==
resolve-from@^1.0.0: resolve-from@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"