mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem Object versions are sorted by `created_at`, but a version's `created_at` doesn't always reflect when it was written. When a bucket is suspended, an upload replaces the null version in place and keeps that row's original `created_at`, so the current version can show up below older ones in the versions panel. ## Solution Sort by `archived_at`. The current version has no `archived_at`, so it comes first, followed by the most recently archived. Co-authored-by: Claude <noreply@anthropic.com>
9 lines
372 B
TypeScript
9 lines
372 B
TypeScript
type ArchivedAt = { archived_at?: string | null }
|
|
|
|
// A null archived_at marks the key's single current version, so it sorts first.
|
|
const archivedTime = (version: ArchivedAt) =>
|
|
version.archived_at ? Date.parse(version.archived_at) : Number.MAX_SAFE_INTEGER
|
|
|
|
export const compareNewestVersionFirst = (a: ArchivedAt, b: ArchivedAt) =>
|
|
archivedTime(b) - archivedTime(a)
|