Posting items in reverse chronological order.

This commit is contained in:
David Jay
2016-11-07 17:12:20 -05:00
parent c5d15eed77
commit 4f33818153
2 changed files with 3 additions and 3 deletions
@@ -91,8 +91,8 @@ export function getStream (assetId) {
/* Sort comments by date*/
let rootComments = []
let childComments = {}
const sorted = json.sort((a,b) => b.created_at - a.created_at)
sorted.reduce((prev, item) => {
json.sort((a,b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())
json.reduce((prev, item) => {
dispatch(addItem(item))
/* Check for root and child comments. */
@@ -15,7 +15,7 @@ export default (state = initialState, action) => {
)
case actions.APPEND_ITEM_ARRAY:
return state.updateIn([action.id, action.property], (prop) => {
return prop ? prop.push(action.value) : fromJS([action.value])
return prop ? prop.unshift(action.value) : fromJS([action.value])
}
)
default: