diff --git a/embark-ui/src/containers/FileContractsContainer.js b/embark-ui/src/containers/FileContractsContainer.js
index 631bab221..b40ba8fe2 100644
--- a/embark-ui/src/containers/FileContractsContainer.js
+++ b/embark-ui/src/containers/FileContractsContainer.js
@@ -1,11 +1,10 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
-import {withRouter} from 'react-router-dom';
import {contract as contractAction} from '../actions';
import ContractLayout from '../components/ContractLayout';
-import {getContractsByFilename} from "../reducers/selectors";
+import {getContractsByPath} from "../reducers/selectors";
class FileContractsContainer extends Component {
componentDidMount() {
@@ -13,17 +12,15 @@ class FileContractsContainer extends Component {
}
render() {
- if (this.props.contract){
- return ;
- } else {
- return ;
- }
+ return (
+ this.props.contracts.map(contract => )
+ )
}
}
function mapStateToProps(state, props) {
return {
- contracts: getContractsByFilename(state, props.currentFile.name),
+ contracts: getContractsByPath(state, props.currentFile.path),
error: state.errorMessage,
loading: state.loading
};
diff --git a/embark-ui/src/reducers/selectors.js b/embark-ui/src/reducers/selectors.js
index 637f7030f..29f0d5213 100644
--- a/embark-ui/src/reducers/selectors.js
+++ b/embark-ui/src/reducers/selectors.js
@@ -68,6 +68,10 @@ export function getContract(state, contractName) {
return state.entities.contracts.find((contract => contract.className === contractName));
}
+export function getContractsByPath(state, path) {
+ return state.entities.contracts.filter((contract => contract.path === path));
+}
+
export function getContractProfile(state, contractName) {
return state.entities.contractProfiles.find((contractProfile => contractProfile.name === contractName));
}