mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor(site): remove redundant client-side sorting of app statuses (#21102)
Depends on #21099
This commit is contained in:
@@ -47,16 +47,12 @@ export const AppStatuses: FC<AppStatusesProps> = ({
|
||||
referenceDate,
|
||||
}) => {
|
||||
const [displayStatuses, setDisplayStatuses] = useState(false);
|
||||
// Statuses are returned from the API sorted by created_at DESC, id DESC.
|
||||
const allStatuses: StatusWithAppInfo[] = agent.apps.flatMap((app) =>
|
||||
app.statuses
|
||||
.map((status) => ({
|
||||
...status,
|
||||
app,
|
||||
}))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
|
||||
),
|
||||
app.statuses.map((status) => ({
|
||||
...status,
|
||||
app,
|
||||
})),
|
||||
);
|
||||
|
||||
if (allStatuses.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user