diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..41564fc20f48b545c2884fec05de3a8baaa1e081 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "allowSyntheticDefaultImports": true + }, + "exclude": [ + "node_modules", + "build" + ] +} diff --git a/src/containers/Building/index.js b/src/containers/Building/index.js index 4f9f6bb024d6a5b1487887a9da96a72e9a536e09..6c734bf4f8b7c951d90213733291c780394d79e0 100644 --- a/src/containers/Building/index.js +++ b/src/containers/Building/index.js @@ -22,7 +22,12 @@ class Building extends Component { render() { const { error, loading, address } = this.props.overview; let mainContent =
; - if (this.props.children && !error && !loading && address !== undefined) { + /* + FIXME: comparison of building_id and buildingId is needed because the + child components have a mismatch with buildingId and address + */ + if (this.props.children && !error && !loading && address !== undefined && + parseInt(this.props.buildingId, 10) === this.props.overview.building_id) { mainContent = React.cloneElement(this.props.children, { buildingId: this.props.buildingId, building: this.props.overview, diff --git a/src/containers/Building/reducer.js b/src/containers/Building/reducer.js index b9c73ebe071fabbb6a5cfddb8297da91b5f1f555..252c4b4e141d2468028bec7209ff8c28cb81689a 100644 --- a/src/containers/Building/reducer.js +++ b/src/containers/Building/reducer.js @@ -23,7 +23,7 @@ export default function (state = initState, action) { switch (action.type) { case LOAD_BUILDING_DETAIL: return { - ...state, + ...initState.projects, overview: { loading: true, error: false, diff --git a/src/containers/Documents/reducer.js b/src/containers/Documents/reducer.js index 6768abd4ba126be67231deecf2a25fa74fbc3eb8..2f73396e587e6ff4086d7548a1d0bb682a322807 100644 --- a/src/containers/Documents/reducer.js +++ b/src/containers/Documents/reducer.js @@ -7,6 +7,10 @@ import { UPLOAD_DOCUMENT_ERROR, } from './constants'; +import { + LOAD_BUILDING_DETAIL, +} from '../Building/constants'; + const initState = { loading: false, error: false, @@ -73,6 +77,9 @@ export default function (state = initState, action) { uploadError: action.error, }; + case LOAD_BUILDING_DETAIL: + return initState; + default: return state; } diff --git a/typings.json b/typings.json deleted file mode 100644 index 520f8bbf1c19eedd4221e0a6d1b7aa7f2492cf5c..0000000000000000000000000000000000000000 --- a/typings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "buildings", - "dependencies": {}, - "compilerOptions": { - "target": "ES6", - "module": "commonjs", - "allowSyntheticDefaultImports": true - }, - "exclude": [ - "node_modules" - ] -}