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 branches found
No related tags found
No related merge requests found
......@@ -43,16 +43,15 @@ const ProjectFetcherHOC = function (WrappedComponent) {
this.props.setInitialProjectId(props.projectId);
}
}
// NOTE: should this be componentWillUpdate or componentWillReceiveProps?
componentWillUpdate (nextProps) {
if (this.props.projectHost !== nextProps.projectHost) {
storage.setProjectHost(nextProps.projectHost);
componentDidUpdate (prevProps) {
if (prevProps.projectHost !== this.props.projectHost) {
storage.setProjectHost(this.props.projectHost);
}
if (this.props.assetHost !== nextProps.assetHost) {
storage.setAssetHost(nextProps.assetHost);
if (prevProps.assetHost !== this.props.assetHost) {
storage.setAssetHost(this.props.assetHost);
}
if (nextProps.isFetchingProjectWithId && !this.props.isFetchingProjectWithId) {
this.fetchProject(nextProps.reduxProjectId, nextProps.projectState);
if (this.props.isFetchingProjectWithId && !prevProps.isFetchingProjectWithId) {
this.fetchProject(this.props.reduxProjectId, this.props.projectState);
}
}
fetchProject (projectId, projectState) {
......
......@@ -21,9 +21,9 @@ const ProjectMetaDataHOC = function (WrappedComponent) {
]);
this.updateProjectMetaData(props.projectId);
}
componentWillReceiveProps (nextProps) {
if (nextProps.isFetchingProjectWithId && !this.props.isFetchingProjectWithId) {
this.updateProjectMetaData(nextProps.projectId);
componentDidUpdate (prevProps) {
if (this.props.isFetchingProjectWithId && !prevProps.isFetchingProjectWithId) {
this.updateProjectMetaData(this.props.projectId);
}
}
updateProjectMetaData (projectId) {
......@@ -80,7 +80,6 @@ const ProjectMetaDataHOC = function (WrappedComponent) {
return {
isFetchingProjectWithId: isFetchingProjectWithId(projectState),
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