Merge pull request #1533 from processing/bug/delete-file-stale-project

[#1532] Update project when deleting file
This commit is contained in:
Cassie Tarakajian 2020-08-05 17:29:29 -04:00 committed by GitHub
commit df99edbc29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -160,7 +160,8 @@ export function deleteFile(id, parentId) {
} }
}; };
apiClient.delete(`/projects/${state.project.id}/files/${id}`, deleteConfig) apiClient.delete(`/projects/${state.project.id}/files/${id}`, deleteConfig)
.then(() => { .then((response) => {
dispatch(setProjectSavedTime(response.data.project.updatedAt));
dispatch({ dispatch({
type: ActionTypes.DELETE_FILE, type: ActionTypes.DELETE_FILE,
id, id,

View file

@ -103,8 +103,8 @@ export function deleteFile(req, res) {
const idsToDelete = getAllDescendantIds(project.files, req.params.file_id); const idsToDelete = getAllDescendantIds(project.files, req.params.file_id);
deleteMany(project.files, [req.params.file_id, ...idsToDelete]); deleteMany(project.files, [req.params.file_id, ...idsToDelete]);
project.files = deleteChild(project.files, req.query.parentId, req.params.file_id); project.files = deleteChild(project.files, req.query.parentId, req.params.file_id);
project.save((innerErr) => { project.save((innerErr, savedProject) => {
res.json(project.files); res.json({ project: savedProject });
}); });
}); });
} }