mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #2242 from appwrite/fix-regions-sorting
This commit is contained in:
@@ -15,8 +15,15 @@ export function filterRegions(regions: Models.ConsoleRegion[]): RegionOption[] {
|
||||
return regions
|
||||
.filter((region) => region.$id !== 'default')
|
||||
.sort((a, b) => {
|
||||
if (a.disabled && !b.disabled) return 1;
|
||||
if (!a.disabled && b.disabled) return -1;
|
||||
// Check if regions are truly available (not disabled and available)
|
||||
const aAvailable = !a.disabled && a.available;
|
||||
const bAvailable = !b.disabled && b.available;
|
||||
|
||||
// Prioritize truly available regions
|
||||
if (aAvailable && !bAvailable) return -1;
|
||||
if (!aAvailable && bAvailable) return 1;
|
||||
|
||||
// Within the same availability group, sort alphabetically
|
||||
return a.name.localeCompare(b.name);
|
||||
})
|
||||
.map((region) => ({
|
||||
|
||||
Reference in New Issue
Block a user