From 82bdf6324dada1f71b60728f21ea3bf6b1ac2416 Mon Sep 17 00:00:00 2001 From: 6ea86b96 <6ea86b96@gmail.com> Date: Fri, 26 May 2017 22:17:01 +0400 Subject: [PATCH] Lookup cost info on file page if it hasn't already been looked up --- ui/js/page/filePage/index.js | 6 +++++- ui/js/page/filePage/view.jsx | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/js/page/filePage/index.js b/ui/js/page/filePage/index.js index f61a3e803..4dae3db60 100644 --- a/ui/js/page/filePage/index.js +++ b/ui/js/page/filePage/index.js @@ -11,6 +11,9 @@ import { import { makeSelectFileInfoForUri, } from 'selectors/file_info' +import { + doFetchCostInfoForUri, +} from 'actions/cost_info' import { makeSelectClaimForUri, makeSelectContentTypeForUri, @@ -41,7 +44,8 @@ const makeSelect = () => { const perform = (dispatch) => ({ navigate: (path, params) => dispatch(doNavigate(path, params)), - fetchFileInfo: (uri) => dispatch(doFetchFileInfo(uri)) + fetchFileInfo: (uri) => dispatch(doFetchFileInfo(uri)), + fetchCostInfo: (uri) => dispatch(doFetchCostInfoForUri(uri)), }) export default connect(makeSelect, perform)(FilePage) diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx index 2373588b7..e7a1e2068 100644 --- a/ui/js/page/filePage/view.jsx +++ b/ui/js/page/filePage/view.jsx @@ -46,6 +46,7 @@ class FilePage extends React.Component{ componentDidMount() { this.fetchFileInfo(this.props) + this.fetchCostInfo(this.props) } componentWillReceiveProps(nextProps) { @@ -58,6 +59,12 @@ class FilePage extends React.Component{ } } + fetchCostInfo(props) { + if (props.costInfo === undefined) { + props.fetchCostInfo(props.uri) + } + } + render() { const { claim,