统一全系统资源加载、轻量趋势与缓存恢复
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export function importIssuePageKey(runId: string, page: number): string {
|
||||
return `${runId}:${page}`;
|
||||
}
|
||||
|
||||
export function matchesImportIssuePage(loadedRunId: string, loadedPage: number, runId: string, page: number): boolean {
|
||||
return loadedRunId === runId && loadedPage === page;
|
||||
}
|
||||
|
||||
export async function runImportPollFollowup<T>(
|
||||
runId: string,
|
||||
isCurrent: (runId: string) => boolean,
|
||||
followup: () => Promise<T>,
|
||||
): Promise<{ started: false; current: false } | { started: true; current: boolean; value: T }> {
|
||||
if (!isCurrent(runId)) return { started: false, current: false };
|
||||
const value = await followup();
|
||||
return { started: true, current: isCurrent(runId), value };
|
||||
}
|
||||
Reference in New Issue
Block a user