Reduce startup git work for workspace snapshots
This commit is contained in:
@@ -21,6 +21,15 @@ export interface PrHint {
|
||||
reviewDecision?: "approved" | "changes_requested" | "pending" | null;
|
||||
}
|
||||
|
||||
interface PrStatusLike {
|
||||
url: string;
|
||||
state: string;
|
||||
isMerged: boolean;
|
||||
checks?: Array<{ name: string; status: string; url: string | null }>;
|
||||
checksStatus?: string;
|
||||
reviewDecision?: string | null;
|
||||
}
|
||||
|
||||
function parsePullRequestNumber(url: string): number | null {
|
||||
try {
|
||||
const pathname = new URL(url).pathname;
|
||||
@@ -36,8 +45,7 @@ function parsePullRequestNumber(url: string): number | null {
|
||||
}
|
||||
}
|
||||
|
||||
function selectWorkspacePrHint(payload: CheckoutPrStatusPayload): PrHint | null {
|
||||
const status = payload.status;
|
||||
export function selectPrHintFromStatus(status: PrStatusLike | null | undefined): PrHint | null {
|
||||
if (!status?.url) {
|
||||
return null;
|
||||
}
|
||||
@@ -62,6 +70,10 @@ function selectWorkspacePrHint(payload: CheckoutPrStatusPayload): PrHint | null
|
||||
};
|
||||
}
|
||||
|
||||
function selectWorkspacePrHint(payload: CheckoutPrStatusPayload): PrHint | null {
|
||||
return selectPrHintFromStatus(payload.status);
|
||||
}
|
||||
|
||||
export function useCheckoutPrStatusQuery({
|
||||
serverId,
|
||||
cwd,
|
||||
|
||||
Reference in New Issue
Block a user