Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use nulls last when sorting users #30430

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: use nulls last when sorting users
  • Loading branch information
alaister committed Nov 12, 2024
commit a02a35ba3fba44c6bf93d933d950afd972b6f211
4 changes: 2 additions & 2 deletions apps/studio/data/auth/users-infinite-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,7 @@ export const getUsersSQL = ({
keywords?: string
providers?: string[]
sort: string
order: string
order: 'asc' | 'desc'
}) => {
const offset = page * USERS_PAGE_LIMIT
const hasValidKeywords = keywords && keywords !== ''
Expand Down Expand Up @@ -73,7 73,7 @@ export const getUsersSQL = ({
const sortOn = sort ?? 'created_at'
const sortOrder = order ?? 'desc'

return `${baseQueryUsers}${conditions.length > 0 ? ` where ${combinedConditions}` : ''} order by "${sortOn}" ${sortOrder} limit ${USERS_PAGE_LIMIT} offset ${offset};`
return `${baseQueryUsers}${conditions.length > 0 ? ` where ${combinedConditions}` : ''} order by "${sortOn}" ${sortOrder} nulls last limit ${USERS_PAGE_LIMIT} offset ${offset};`
}

export type UsersData = { result: User[] }
Expand Down