mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 19:34:29 +00:00
* fix(mobile): keep the selected GitHub project when switching projects Picking another GitHub Project on the phone snapped back to the first one. A remembered desktop Board view made the pick throw before it committed, and a committed pick wrote picker rows (title, summary) into settings, which the host's strict schema refused, so the next hydration restored the old project. Commit only identity fields, ask for a view when the remembered one is not a table, keep the candidate project's views out of the active list until it commits, drop late view replies from an earlier pick, and key Browse rows by project identity. Co-authored-by: Eng. Mahmoud Bek ElNemer <tt21913@gmail.com> * fix(mobile): keep github.com implicit in project refs and error on projects with no table view --------- Co-authored-by: Eng. Mahmoud Bek ElNemer <tt21913@gmail.com>
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { isDefaultGitHubHost } from './repository-identity-key'
|
|
|
|
export type GitHubProjectIdentity = {
|
|
owner: string
|
|
ownerType: 'organization' | 'user'
|
|
number: number
|
|
host?: string
|
|
}
|
|
|
|
/** Stable settings/cache identity. Default-host keys intentionally retain the
|
|
* legacy shape so existing github.com project preferences survive upgrades. */
|
|
export function githubProjectIdentityKey(project: GitHubProjectIdentity): string {
|
|
const projectKey = `${project.ownerType}:${project.owner.toLowerCase()}:${project.number}`
|
|
const host = project.host?.trim().toLowerCase()
|
|
return host && !isDefaultGitHubHost(host) ? `${host}:${projectKey}` : projectKey
|
|
}
|
|
|
|
/** Project API calls must pin github.com too; otherwise process GH_HOST can
|
|
* redirect a host-less persisted project to an Enterprise server. */
|
|
export function githubProjectHost(host?: string | null): string {
|
|
const trimmed = host?.trim()
|
|
return trimmed || 'github.com'
|
|
}
|
|
|
|
/** Settings rows carry only identity fields: the host's settings schema rejects extra keys
|
|
* such as a picker row's title, and hosts before 2026-07-21 reject `host`, so github.com stays implicit. */
|
|
export function toGitHubProjectIdentity(project: GitHubProjectIdentity): GitHubProjectIdentity {
|
|
const host = project.host?.trim()
|
|
return {
|
|
owner: project.owner,
|
|
ownerType: project.ownerType,
|
|
number: project.number,
|
|
...(host && !isDefaultGitHubHost(host) ? { host } : {})
|
|
}
|
|
}
|