From f8d598549d2bd200a5f588a554d3623a6ec6b751 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 13 Nov 2018 12:23:05 -0500 Subject: [PATCH] Update instead of replacing project info to match API. The API endpoint will return just the updated slice of the projectInfo, so just update the projectInfo instead of replacing. --- src/redux/preview.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/redux/preview.js b/src/redux/preview.js index d8a8d6f62..30f0830b3 100644 --- a/src/redux/preview.js +++ b/src/redux/preview.js @@ -55,6 +55,10 @@ module.exports.previewReducer = (state, action) => { projectInfo: action.info ? action.info : {}, projectNotAvailable: !action.info }); + case 'UPDATE_PROJECT_INFO': + return Object.assign({}, state, { + projectInfo: Object.assign({}, state.projectInfo, action.info) + }); case 'SET_REMIXES': return Object.assign({}, state, { remixes: action.items @@ -182,6 +186,11 @@ module.exports.setProjectInfo = info => ({ info: info }); +module.exports.updateProjectInfo = info => ({ + type: 'UPDATE_PROJECT_INFO', + info: info +}); + module.exports.setOriginalInfo = info => ({ type: 'SET_ORIGINAL', info: info @@ -785,7 +794,7 @@ module.exports.shareProject = (projectId, token) => (dispatch => { return; } dispatch(module.exports.setFetchStatus('project', module.exports.Status.FETCHED)); - dispatch(module.exports.setProjectInfo(body)); + dispatch(module.exports.updateProjectInfo(body)); }); });