fix githost factory initialization

This commit is contained in:
Caleb Owens 2024-08-15 19:00:44 +02:00
parent 84df8857cc
commit d3e3ffffd2

View File

@ -76,7 +76,7 @@
const showHistoryView = persisted(false, 'showHistoryView');
const octokit = $derived(accessToken ? octokitFromAccessToken(accessToken) : undefined);
const gitHostFactory = $derived(octokit ? new DefaultGitHostFactory(octokit) : undefined);
const gitHostFactory = $derived(new DefaultGitHostFactory(octokit));
const repoInfo = $derived(remoteUrl ? parseRemoteUrl(remoteUrl) : undefined);
const forkInfo = $derived(forkUrl && forkUrl !== remoteUrl ? parseRemoteUrl(forkUrl) : undefined);
const baseBranchName = $derived($baseBranch?.shortName);
@ -118,8 +118,9 @@
$effect.pre(() => {
const gitHost =
repoInfo && baseBranchName
? gitHostFactory?.build(repoInfo, baseBranchName, forkInfo)
? gitHostFactory.build(repoInfo, baseBranchName, forkInfo)
: undefined;
const ghListService = gitHost?.listService();
listServiceStore.set(ghListService);