Lookup cost info on file page if it hasn't already been looked up
This commit is contained in:
parent
3bb08fd987
commit
82bdf6324d
2 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue