Skip to content
Snippets Groups Projects
Commit 9e7da173 authored by Ben Wheeler's avatar Ben Wheeler
Browse files

changed componentWillReceiveProps to componentDidUpdate in project-fetcher-hoc...

changed componentWillReceiveProps to componentDidUpdate in project-fetcher-hoc and project-metadata-hoc
parent 55af70a9
No related merge requests found
...@@ -43,16 +43,15 @@ const ProjectFetcherHOC = function (WrappedComponent) { ...@@ -43,16 +43,15 @@ const ProjectFetcherHOC = function (WrappedComponent) {
this.props.setInitialProjectId(props.projectId); this.props.setInitialProjectId(props.projectId);
} }
} }
// NOTE: should this be componentWillUpdate or componentWillReceiveProps? componentDidUpdate (prevProps) {
componentWillUpdate (nextProps) { if (prevProps.projectHost !== this.props.projectHost) {
if (this.props.projectHost !== nextProps.projectHost) { storage.setProjectHost(this.props.projectHost);
storage.setProjectHost(nextProps.projectHost);
} }
if (this.props.assetHost !== nextProps.assetHost) { if (prevProps.assetHost !== this.props.assetHost) {
storage.setAssetHost(nextProps.assetHost); storage.setAssetHost(this.props.assetHost);
} }
if (nextProps.isFetchingProjectWithId && !this.props.isFetchingProjectWithId) { if (this.props.isFetchingProjectWithId && !prevProps.isFetchingProjectWithId) {
this.fetchProject(nextProps.reduxProjectId, nextProps.projectState); this.fetchProject(this.props.reduxProjectId, this.props.projectState);
} }
} }
fetchProject (projectId, projectState) { fetchProject (projectId, projectState) {
......
...@@ -21,9 +21,9 @@ const ProjectMetaDataHOC = function (WrappedComponent) { ...@@ -21,9 +21,9 @@ const ProjectMetaDataHOC = function (WrappedComponent) {
]); ]);
this.updateProjectMetaData(props.projectId); this.updateProjectMetaData(props.projectId);
} }
componentWillReceiveProps (nextProps) { componentDidUpdate (prevProps) {
if (nextProps.isFetchingProjectWithId && !this.props.isFetchingProjectWithId) { if (this.props.isFetchingProjectWithId && !prevProps.isFetchingProjectWithId) {
this.updateProjectMetaData(nextProps.projectId); this.updateProjectMetaData(this.props.projectId);
} }
} }
updateProjectMetaData (projectId) { updateProjectMetaData (projectId) {
...@@ -80,7 +80,6 @@ const ProjectMetaDataHOC = function (WrappedComponent) { ...@@ -80,7 +80,6 @@ const ProjectMetaDataHOC = function (WrappedComponent) {
return { return {
isFetchingProjectWithId: isFetchingProjectWithId(projectState), isFetchingProjectWithId: isFetchingProjectWithId(projectState),
projectId: state.scratchGui.projectId.projectId projectId: state.scratchGui.projectId.projectId
// token: state.session.session && state.session.session.user && state.session.session.user.token
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment