From 1b50cb06d4953ecbbbae615f85b10f4816d86afb Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 17 Jan 2017 11:38:15 -0700 Subject: [PATCH 1/5] gotta commit something to see changes --- client/coral-framework/actions/user.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js index f0e6f7fba..7d6094ebe 100644 --- a/client/coral-framework/actions/user.js +++ b/client/coral-framework/actions/user.js @@ -37,10 +37,14 @@ export const fetchCommentsByUserId = userId => { const state = getState(); comments.forEach(comment => dispatch(addItem(comment, 'comments'))); assets.forEach(asset => { + const prevAsset = state.items.getIn(['assets', asset.id]); + if (prevAsset) { - // Include data such as hydrated comments from assets already in the system. - const prevAsset = state.items.getIn(['assets', asset.id]).toJS(); - dispatch(addItem({...prevAsset, ...asset}, 'assets')); + // Include data such as hydrated comments from assets already in the system. + dispatch(addItem({...prevAsset.toJS(), ...asset}, 'assets')); + } else { + dispatch(addItem(asset, 'assets')); + } }); dispatch({type: actions.COMMENTS_BY_USER_SUCCESS, comments: comments.map(comment => comment.id)}); From af7105994846dfcf38ca9efddf926806a3b39f8e Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 17 Jan 2017 14:53:28 -0700 Subject: [PATCH 2/5] Revert "My Comment bug fix" --- client/coral-framework/actions/user.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js index 7d6094ebe..f0e6f7fba 100644 --- a/client/coral-framework/actions/user.js +++ b/client/coral-framework/actions/user.js @@ -37,14 +37,10 @@ export const fetchCommentsByUserId = userId => { const state = getState(); comments.forEach(comment => dispatch(addItem(comment, 'comments'))); assets.forEach(asset => { - const prevAsset = state.items.getIn(['assets', asset.id]); - if (prevAsset) { - // Include data such as hydrated comments from assets already in the system. - dispatch(addItem({...prevAsset.toJS(), ...asset}, 'assets')); - } else { - dispatch(addItem(asset, 'assets')); - } + // Include data such as hydrated comments from assets already in the system. + const prevAsset = state.items.getIn(['assets', asset.id]).toJS(); + dispatch(addItem({...prevAsset, ...asset}, 'assets')); }); dispatch({type: actions.COMMENTS_BY_USER_SUCCESS, comments: comments.map(comment => comment.id)}); From 14fd5e44511754938e41f63cbad0894217fcd316 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 17 Jan 2017 15:12:19 -0700 Subject: [PATCH 3/5] does a null check --- client/coral-framework/actions/user.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js index f0e6f7fba..021c48eeb 100644 --- a/client/coral-framework/actions/user.js +++ b/client/coral-framework/actions/user.js @@ -37,10 +37,15 @@ export const fetchCommentsByUserId = userId => { const state = getState(); comments.forEach(comment => dispatch(addItem(comment, 'comments'))); assets.forEach(asset => { + const prevAsset = state.items.getIn(['assets', asset.id]); - // Include data such as hydrated comments from assets already in the system. - const prevAsset = state.items.getIn(['assets', asset.id]).toJS(); - dispatch(addItem({...prevAsset, ...asset}, 'assets')); + if (prevAsset) { + + // Include data such as hydrated comments from assets already in the system. + dispatch(addItem({...prevAsset.toJS(), ...asset}, 'assets')); + } else { + dispatch(addItem(asset, 'assets')); + } }); dispatch({type: actions.COMMENTS_BY_USER_SUCCESS, comments: comments.map(comment => comment.id)}); From 810cc002c936e92fb63f1193f14409b739813075 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Wed, 18 Jan 2017 10:02:15 -0700 Subject: [PATCH 4/5] add nodemon config to prevent server restart while developing front end --- nodemon.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 nodemon.json diff --git a/nodemon.json b/nodemon.json new file mode 100644 index 000000000..834e6c054 --- /dev/null +++ b/nodemon.json @@ -0,0 +1,4 @@ +{ + "verbose": true, + "ignore": ["tests/*", "client/*", "dist/*"] +} From f9bc6237647941e964eaff8e2a5af50d910abfb9 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Wed, 18 Jan 2017 10:10:47 -0700 Subject: [PATCH 5/5] make a hidden file --- nodemon.json => .nodemon.json | 0 package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename nodemon.json => .nodemon.json (100%) diff --git a/nodemon.json b/.nodemon.json similarity index 100% rename from nodemon.json rename to .nodemon.json diff --git a/package.json b/package.json index e6e211d07..7948d5aa3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "app.js", "scripts": { "start": "./bin/cli serve --jobs", - "dev-start": "nodemon --exec \"./bin/cli -c .env serve --jobs\"", + "dev-start": "nodemon --config .nodemon.json --exec \"./bin/cli -c .env serve --jobs\"", "build": "NODE_ENV=production webpack --config webpack.config.js --bail", "build-watch": "NODE_ENV=development webpack --config webpack.config.dev.js --watch", "lint": "eslint bin/* .",