Files
supabase/apps/studio/data/content/keys.ts
T
Alaister YoungandJoshen Lim f6d9617413 chore: paginate user content (#30675)
* chore: paginate user content

* progress

* loading states

* add load more buttons to private snippets

* working pagination

* fix some types

* always show snippet counts

* support new api parameters

* favorite snippets

* progress

* searching

* paginate root folder

* fix renaming snippets

* fix ts

* removed unused prop

* Shift sharing/unsharing query logic outside of valtio to leverage on RQ only

* Fix invalidation on an unsaved snippet

* Clean up

* Fix

* Clean up

* Update API type

* Update API

* fix duplicate snippets error after moving a snippet

* add currently selected snippet

* Fix unsharing a snippet that has yet to be opened

* i'm dumb

* fix sharing a snippet

* fix sharing and unsharing

* show favorite or shared snippet in list even if it's in another page

* Fix wrong import for debounce

* Fix false positive toast error when creating custom report

* Update API type

* Change create new snippet CTA to link back to /new with skip flag

* Fix saving logs explorer query

* Bump page number

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-12-19 16:08:14 +08:00

34 lines
1.4 KiB
TypeScript

import type { ContentType } from './content-query'
import type { SqlSnippet } from './sql-snippets-query'
export const contentKeys = {
allContentLists: (projectRef: string | undefined) => ['projects', projectRef, 'content'] as const,
list: (projectRef: string | undefined, type: ContentType | undefined) =>
['projects', projectRef, 'content', type] as const,
sqlSnippets: (
projectRef: string | undefined,
options?: {
sort?: 'inserted_at' | 'name'
name?: string
visibility?: SqlSnippet['visibility']
favorite?: boolean
}
) => ['projects', projectRef, 'content', 'sql', options].filter(Boolean),
folders: (
projectRef: string | undefined,
options?: { sort?: 'inserted_at' | 'name'; name?: string }
) => ['projects', projectRef, 'content', 'folders', options].filter(Boolean),
folderContents: (
projectRef: string | undefined,
id?: string,
options?: { sort?: 'inserted_at' | 'name'; name?: string }
) => ['projects', projectRef, 'content', 'folders', id, options].filter(Boolean),
resource: (projectRef: string | undefined, id?: string) =>
['projects', projectRef, 'content', id] as const,
count: (
projectRef: string | undefined,
type?: string,
options?: { visibility?: SqlSnippet['visibility']; favorite?: boolean; name?: string }
) => ['projects', projectRef, 'content', 'count', type, options].filter(Boolean),
}