For #675, needs more testing to know if it fixes it! (#784)

* for #675

* fix linting errors
This commit is contained in:
Cassie Tarakajian 2018-12-13 17:06:34 -05:00 committed by GitHub
parent eebe9d9252
commit 244af16b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ import { browserHistory } from 'react-router';
import axios from 'axios'; import axios from 'axios';
import objectID from 'bson-objectid'; import objectID from 'bson-objectid';
import each from 'async/each'; import each from 'async/each';
import { isEqual } from 'lodash'; import { isEqual, pick } from 'lodash';
import * as ActionTypes from '../../../constants'; import * as ActionTypes from '../../../constants';
import { showToast, setToastText } from './toast'; import { showToast, setToastText } from './toast';
import { setUnsavedChanges, import { setUnsavedChanges,
@ -77,7 +77,10 @@ export function saveProject(autosave = false) {
.then((response) => { .then((response) => {
const currentState = getState(); const currentState = getState();
const savedProject = Object.assign({}, response.data); const savedProject = Object.assign({}, response.data);
if (!isEqual(currentState.files, response.data.files)) { if (!isEqual(
pick(currentState.files, ['name', 'children', 'content']),
pick(response.data.files, ['name', 'children', 'content'])
)) {
savedProject.files = currentState.files; savedProject.files = currentState.files;
dispatch(setUnsavedChanges(true)); dispatch(setUnsavedChanges(true));
} else { } else {