Fix idleness after PR creation

- also drop unused dependencies
This commit is contained in:
Mattias Granlund 2024-01-23 11:42:48 +01:00
parent 0254190eaf
commit d798ef84c0
3 changed files with 6 additions and 17 deletions

View File

@ -47,7 +47,7 @@
class:grow
class:not-clickable={notClickable}
bind:this={element}
{disabled}
disabled={disabled || loading}
on:click
{id}
tabindex={notClickable ? -1 : tabindex}

View File

@ -1,7 +1,6 @@
import * as toasts from '$lib/utils/toasts';
import lscache from 'lscache';
import type { BaseBranchService, VirtualBranchService } from '$lib/vbranches/branchStoresCache';
import type { BranchController } from '$lib/vbranches/branchController';
import type { BaseBranchService } from '$lib/vbranches/branchStoresCache';
import type { UserService } from '$lib/stores/user';
import type { Octokit } from '@octokit/rest';
import { newClient } from '$lib/github/client';
@ -51,12 +50,7 @@ export class GitHubService {
private enabled = false;
constructor(
private branchController: BranchController,
private vbranchService: VirtualBranchService,
userService: UserService,
baseBranchService: BaseBranchService
) {
constructor(userService: UserService, baseBranchService: BaseBranchService) {
// A few things will cause the baseBranch to update, so we filter for distinct
// changes to the remoteUrl.
const distinctUrl$ = baseBranchService.base$.pipe(distinct((ctx) => ctx?.remoteUrl));
@ -197,9 +191,9 @@ export class GitHubService {
} else {
console.log('Unable to create PR despite retrying', err);
}
this.setIdle(branchId);
return throwError(() => err);
})
}),
tap(() => this.setIdle(branchId))
)
);
}

View File

@ -33,12 +33,7 @@ export const load: LayoutLoad = async ({ params, parent }) => {
baseBranchService
);
const githubService = new GitHubService(
branchController,
vbranchService,
userService,
baseBranchService
);
const githubService = new GitHubService(userService, baseBranchService);
const branchService = new BranchService(vbranchService, remoteBranchService, githubService);
return {