Skip to content

Commit

Permalink
Remove unnecessary front-end sort
Browse files Browse the repository at this point in the history
  • Loading branch information
cayb0rg committed Feb 1, 2024
1 parent 0c9200e commit c3549e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/components/hooks/useInstanceList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export default function useInstanceList() {

const [errorState, setErrorState] = useState(false)

// Helper function to sort widgets
const _compareWidgets = (a, b) => { return (b.created_at - a.created_at) }

// transforms data object returned from infinite query into one we can use in the my-widgets-page component
// this creates a flat list of instances from the paginated list that's subsequently sorted
const formatData = (list) => {
Expand All @@ -31,7 +28,7 @@ export default function useInstanceList() {
}
}))
)
].sort(_compareWidgets)
]
} else return []
}

Expand Down
5 changes: 1 addition & 4 deletions src/components/hooks/useSearchInstances.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export default function useSearchInstances(query = "") {

const [errorState, setErrorState] = useState(false)

// Helper function to sort widgets
const _compareWidgets = (a, b) => { return (b.created_at - a.created_at) }

// transforms data object returned from infinite query
const formatData = (list) => {
if (list?.type == 'error') {
Expand All @@ -29,7 +26,7 @@ export default function useSearchInstances(query = "") {
}
}))
)
].sort(_compareWidgets) // sort instances by creation date
]
} else return []
}

Expand Down

0 comments on commit c3549e0

Please sign in to comment.