mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-01 22:12:04 +03:00
✨ feat: add sleep function to delay PR creation after pushing branch
This commit is contained in:
parent
e0aea09ef1
commit
e0d889dd85
3
packages/ui/src/lib/utils/sleep.ts
Normal file
3
packages/ui/src/lib/utils/sleep.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function sleep(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
import Tag from './Tag.svelte';
|
||||
import { open } from '@tauri-apps/api/shell';
|
||||
import toast from 'svelte-french-toast';
|
||||
import { sleep } from '$lib/utils/sleep';
|
||||
|
||||
export let branch: Branch;
|
||||
export let githubContext: GitHubIntegrationContext | undefined;
|
||||
@ -64,7 +65,10 @@
|
||||
async function push(opts?: { createPr: boolean }) {
|
||||
isPushing = true;
|
||||
await branchController.pushBranch(branch.id, branch.requiresForce);
|
||||
if (opts?.createPr) await createPr();
|
||||
if (opts?.createPr) {
|
||||
await sleep(500);
|
||||
await createPr();
|
||||
}
|
||||
isPushing = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user