Skip to content

Commit

Permalink
Sort descending by last opened
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfelixrico committed Apr 3, 2024
1 parent 2b1079d commit 8e12639
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/modules/home/HomeActionStepHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ListGroup from 'react-bootstrap/ListGroup'
import Button from 'react-bootstrap/Button'
import { useState } from 'react'
import BasicModal from '@/modules/common/BasicModal'
import sortBy from 'lodash/sortBy'

function HistoryEntry({
room,
Expand Down Expand Up @@ -66,7 +67,10 @@ export default function HomeActionStepHistory() {
const [show, setShow] = useState(false)

const rooms = useLiveQuery(async () => {
return await roomDb.rooms.toArray()
return sortBy(
await roomDb.rooms.toArray(),
({ lastOpened }) => lastOpened
).reverse()
})

async function deleteHistoryEntry(id: string) {
Expand Down

0 comments on commit 8e12639

Please sign in to comment.