From 13ad5371682500a71201ed63fa04d31806a50047 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Mon, 20 Feb 2017 09:51:13 -0500 Subject: [PATCH 1/2] Remove typings.json and add jsconfig --- jsconfig.json | 11 +++++++++++ typings.json | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 jsconfig.json delete mode 100644 typings.json diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..41564fc2 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "allowSyntheticDefaultImports": true + }, + "exclude": [ + "node_modules", + "build" + ] +} diff --git a/typings.json b/typings.json deleted file mode 100644 index 520f8bbf..00000000 --- a/typings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "buildings", - "dependencies": {}, - "compilerOptions": { - "target": "ES6", - "module": "commonjs", - "allowSyntheticDefaultImports": true - }, - "exclude": [ - "node_modules" - ] -} -- GitLab From 31e4f94616aa42dcc05e70bbd858e98cd8c11b39 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Mon, 20 Feb 2017 12:08:42 -0500 Subject: [PATCH 2/2] Add comparison of url building id and redux building id --- src/containers/Building/index.js | 7 ++++++- src/containers/Building/reducer.js | 2 +- src/containers/Documents/reducer.js | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/containers/Building/index.js b/src/containers/Building/index.js index 4f9f6bb0..6c734bf4 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 b9c73ebe..252c4b4e 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 6768abd4..2f73396e 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; } -- GitLab