Files
supabase/apps/studio/data/projects/keys.ts
T
Joshen Lim fe8b4df66d Chore/tiny refactor org limit (#51550)
## Context

Tiny refactor that I happened to pass by as I was reviewing other PRs

`useOrgProjectsInfiniteQuery` has a default `limit` value at 96 set in
the hook, 96 mainly for the home page to render a full row of cards
since cards are rendered in rows of 3

However, we have a couple of callsites for `useOrgProjectsInfiniteQuery`
that were passing a different `limit` value, hence these would be
triggered as a separate API request.

Am opting to remove the `limit` parameter from
`useOrgProjectsInfiniteQuery` so that the limit is standardized to 96
- So that data can be cached without having to invoke another API
request wherever `useOrgProjectsInfiniteQuery` is called
- I doubt that there'll be a need in a UI that will require calling
`useOrgProjectsInfiniteQuery` with a separate value for `limit` but
please do let me know otherwise if I might be overlooking anything!
2026-10-13 11:06:49 +08:00

43 lines
1.9 KiB
TypeScript

export const INFINITE_PROJECTS_KEY_PREFIX = 'all-projects-infinite'
export const projectKeys = {
infiniteList: (params?: {
limit: number
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
search?: string
}) => [INFINITE_PROJECTS_KEY_PREFIX, params].filter(Boolean),
infiniteListByOrg: (
slug: string | undefined,
params?: {
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
search?: string
statuses?: string[]
}
) => [INFINITE_PROJECTS_KEY_PREFIX, slug, params].filter(Boolean),
status: (projectRef: string | undefined) => ['project', projectRef, 'status'] as const,
types: (projectRef: string | undefined) => ['project', projectRef, 'types'] as const,
detail: (projectRef: string | undefined) => ['project', projectRef, 'detail'] as const,
serviceVersions: (projectRef: string | undefined) =>
['project', projectRef, 'service-versions'] as const,
readonlyStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'readonly-status'] as const,
projectTransfer: (projectRef: string | undefined, targetOrganizationSlug: string | undefined) =>
['projects', 'transfer', projectRef, targetOrganizationSlug] as const,
projectTransferPreview: (
projectRef: string | undefined,
targetOrganizationSlug: string | undefined
) => ['projects', 'transfer', projectRef, targetOrganizationSlug, 'preview'] as const,
pauseStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'pause-status'] as const,
projectMembers: (projectRef: string | undefined) => ['project', projectRef, 'members'] as const,
// Clone to new project
listCloneBackups: (projectRef: string | undefined) =>
['projects', projectRef, 'clone-backups'] as const,
listCloneStatus: (projectRef: string | undefined) =>
['projects', projectRef, 'clone-status'] as const,
bannerProjectsByOrg: (slug: string) => ['banner', 'org-projects', slug] as const,
}