Skip to content

Commit

Permalink
fix: sort media (most recent first)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed Oct 6, 2019
1 parent 0516d07 commit 3f999c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/MediaView/MediaViewContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ const MediaViewContent = ({
}: CommonViewContentProps) => {
const images = useMemo(() => {
const images = []
for (const obs of observations) {
const sortedObservations = observations.sort((a, b) => {
return a.created_at > b.created_at
? -1
: a.created_at < b.created_at
? 1
: 0
})
for (const obs of sortedObservations) {
const attachments = obs.attachments || []
for (let i = 0; i < attachments.length; i++) {
// Only return attachments with images
Expand Down

0 comments on commit 3f999c1

Please sign in to comment.