Skip to content

Commit

Permalink
feat: improve listing order (#1157)
Browse files Browse the repository at this point in the history
* feat(clusters): fix order

* feat(services): fix order

* feat(environments): fix order
  • Loading branch information
ctjhoa authored Feb 5, 2024
1 parent 14f1de4 commit caa7a62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ interface UseClustersProps {
export function useClusters({ organizationId }: UseClustersProps) {
return useQuery({
...queries.clusters.list({ organizationId }),
select(clusters) {
clusters?.sort(({ name: nameA }, { name: nameB }) => nameA.localeCompare(nameB))
return clusters
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export interface UseEnvironmentsProps {
export function useEnvironments({ projectId }: UseEnvironmentsProps) {
const { data: environments, isLoading: isEnvironmentsLoading } = useQuery({
...queries.environments.list({ projectId }),
select(environments) {
environments?.sort(({ name: nameA }, { name: nameB }) => nameA.localeCompare(nameB))
return environments
},
})

const runningStatusResults = useQueries({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export interface UseServicesProps {
export function useServices({ environmentId }: UseServicesProps) {
const { data: services, isLoading: isServicesLoading } = useQuery({
...queries.services.list(environmentId!),
select(services) {
services.sort(({ name: nameA }, { name: nameB }) => nameA.localeCompare(nameB))
return services
},
enabled: Boolean(environmentId),
})

Expand Down

0 comments on commit caa7a62

Please sign in to comment.