Skip to content

Commit

Permalink
INN-3003: Fix consistent sort order for apps (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
djfarrelly committed May 6, 2024
1 parent 3402057 commit e572083
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export function Apps({ isArchived = false }: Props) {

const { apps, latestUnattachedSyncTime } = res.data;
const hasApps = apps.length > 0;
// Sort apps by latest sync time
const sortedApps = apps.sort((a, b) => {
return (
(b.latestSync ? new Date(b.latestSync.lastSyncedAt).getTime() : 0) -
(a.latestSync ? new Date(a.latestSync.lastSyncedAt).getTime() : 0)
);
});

return (
<div className="mb-4 mt-16 flex items-center justify-center">
Expand All @@ -54,7 +61,7 @@ export function Apps({ isArchived = false }: Props) {
{!hasApps && isArchived && (
<p className="rounded-lg bg-slate-500 p-4 text-center text-white">No archived apps</p>
)}
{apps.map((app) => {
{sortedApps.map((app) => {
return (
<AppCard
app={app}
Expand Down

0 comments on commit e572083

Please sign in to comment.