Skip to content

Commit 0e78c84

Browse files
committed
fix: #4236
1 parent 1dfe69f commit 0e78c84

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/projects/list/components/Projects/Projects.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,7 @@ class Projects extends Component {
331331
}
332332
}
333333

334-
const mapStateToProps = ({ projectSearch, members, loadUser, projectState, templates, notifications }) => {
335-
if (projectState.project && projectState.project.id && projectSearch.projects) {
336-
const index = _.findIndex(projectSearch.projects, {id: projectState.project.id})
337-
projectSearch.projects.splice(index, 1, projectState.project)
338-
}
334+
const mapStateToProps = ({ projectSearch, members, loadUser, templates, notifications }) => {
339335
const defaultListView = hasPermission(PERMISSIONS.SEE_GRID_VIEW_BY_DEFAULT) ? PROJECTS_LIST_VIEW.GRID : PROJECTS_LIST_VIEW.CARD
340336
return {
341337
currentUser : {

src/projects/reducers/projectSearch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SET_PROJECTS_LIST_VIEW,
77
PROJECT_LIST_DEFAULT_CRITERIA,
88
PROJECT_SORT,
9+
UPDATE_PROJECT_SUCCESS,
910
DELETE_PROJECT_SUCCESS,
1011
ACCEPT_OR_REFUSE_INVITE_SUCCESS,
1112
ADMIN_ROLES,
@@ -157,6 +158,13 @@ export default function(state = initialState, action) {
157158
projectsListView: action.payload
158159
})
159160

161+
case UPDATE_PROJECT_SUCCESS: {
162+
const { projects } = state
163+
const projectIndex = _.findIndex(projects, {id: action.payload.id})
164+
return update(state, {
165+
projects: { $splice: [[projectIndex, 1, action.payload]] }
166+
})
167+
}
160168
case DELETE_PROJECT_SUCCESS: {
161169
return Object.assign({}, state, {
162170
refresh: true

0 commit comments

Comments
 (0)