Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/projects/reducers/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,17 +473,17 @@ export const projectState = function (state=initialState, action) {
// after updating project they will be lost, so here we restore them
// TODO better don't add additional values to `project` object and keep additional values separately
const restoredProject = {
// if these arrays are not returned we should init them with empty arrays
// as later code counts on this
attachments: [],
members: [],

...action.payload,

// restore data which we put into `project` object using other reducers
budget: _.cloneDeep(state.project.budget),
duration: _.cloneDeep(state.project.duration),
invites: _.cloneDeep(state.project.invites),
// the next properties we also could modify by other reducers, so we restore them,
// and also, we fallback to the default empty array [] as the code relies on it
// we should not `cloneDeep` these values as they are not changed
attachments: _.get(state.project, 'attachments', []),
members: _.get(state.project, 'members', []),
invites: _.get(state.project, 'invites', []),
}

return Object.assign({}, state, {
Expand Down