From f4d13840c0a90e47c5bc1807455711afa702a969 Mon Sep 17 00:00:00 2001 From: Chris Lawton <chris.lawton@torchbox.com> Date: Wed, 8 May 2019 10:33:17 +0100 Subject: [PATCH] sort grouped items by last updated in the detail view --- .../static_src/src/app/src/components/GroupedListing/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opentech/static_src/src/app/src/components/GroupedListing/index.js b/opentech/static_src/src/app/src/components/GroupedListing/index.js index 88bd5dc9e..43c72b22d 100644 --- a/opentech/static_src/src/app/src/components/GroupedListing/index.js +++ b/opentech/static_src/src/app/src/components/GroupedListing/index.js @@ -89,6 +89,10 @@ export default class GroupedListing extends React.Component { items: values.reduce((acc, value) => acc.concat(groupedItems[value] || []), []) })).filter(({items}) => items.length !== 0) + orderedItems.map(value => { + value.items.sort((a,b) => a.lastUpdate > b.lastUpdate ? -1 : 1) + }) + this.setState({orderedItems}); } -- GitLab