Chore/remove unpaginated projects endpoint from docs (#39771)

* Use paginated projects endpoint for docs

* Deprecate old projects query

* Fix

* Fix

* fix(docs branch selector)

* refactor(docs project selector): simplify dom

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
This commit is contained in:
Joshen Lim
2025-10-22 23:39:13 +08:00
committed by GitHub
parent 7f31118db0
commit f2122b64f2
8 changed files with 396 additions and 122 deletions

View File

@@ -1,9 +1,8 @@
import type { BranchesData } from '~/lib/fetch/branches'
import type { OrganizationsData } from '~/lib/fetch/organizations'
import type { ProjectsData } from '~/lib/fetch/projects'
import { ProjectInfoInfinite } from '~/lib/fetch/projects-infinite'
export type Org = OrganizationsData[number]
export type Project = ProjectsData[number]
export type Branch = BranchesData[number]
export type Variable = 'url' | 'publishable' | 'anon' | 'sessionPooler'
@@ -39,11 +38,17 @@ type DeepReadonly<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>
}
export function toDisplayNameOrgProject(org: DeepReadonly<Org>, project: DeepReadonly<Project>) {
export function toDisplayNameOrgProject(
org: DeepReadonly<Org>,
project: DeepReadonly<ProjectInfoInfinite>
) {
return `${org.name} / ${project.name}`
}
export function toOrgProjectValue(org: DeepReadonly<Org>, project: DeepReadonly<Project>) {
export function toOrgProjectValue(
org: DeepReadonly<Org>,
project: DeepReadonly<ProjectInfoInfinite>
) {
return escapeDoubleQuotes(
// @ts-ignore -- problem in OpenAPI spec -- project has ref property
JSON.stringify([org.id, project.ref, removeDoubleQuotes(toDisplayNameOrgProject(org, project))])