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 {
|
import {
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
} from 'selectors/file_info'
|
} from 'selectors/file_info'
|
||||||
|
import {
|
||||||
|
doFetchCostInfoForUri,
|
||||||
|
} from 'actions/cost_info'
|
||||||
import {
|
import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectContentTypeForUri,
|
makeSelectContentTypeForUri,
|
||||||
|
@ -41,7 +44,8 @@ const makeSelect = () => {
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
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)
|
export default connect(makeSelect, perform)(FilePage)
|
||||||
|
|
|
@ -46,6 +46,7 @@ class FilePage extends React.Component{
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.fetchFileInfo(this.props)
|
this.fetchFileInfo(this.props)
|
||||||
|
this.fetchCostInfo(this.props)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -58,6 +59,12 @@ class FilePage extends React.Component{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetchCostInfo(props) {
|
||||||
|
if (props.costInfo === undefined) {
|
||||||
|
props.fetchCostInfo(props.uri)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
claim,
|
claim,
|
||||||
|
|
Loading…
Add table
Reference in a new issue