|
2 | 2 | import { DEFAULT_FORGE_FACTORY } from '$lib/forge/forgeFactory.svelte';
|
3 | 3 | import { GITLAB_STATE } from '$lib/forge/gitlab/gitlabState.svelte';
|
4 | 4 | import { PROJECTS_SERVICE } from '$lib/project/projectsService';
|
5 |
| - import { inject } from '@gitbutler/core/context'; |
| 5 | + import { inject, injectOptional } from '@gitbutler/core/context'; |
6 | 6 | import { Link, SectionCard, Select, SelectItem, Spacer, Textbox } from '@gitbutler/ui';
|
| 7 | + import { writable } from 'svelte/store'; |
7 | 8 |
|
8 | 9 | import type { ForgeName } from '$lib/forge/interface/forge';
|
9 | 10 | import type { Project } from '$lib/project/project';
|
10 | 11 |
|
11 | 12 | const { projectId }: { projectId: string } = $props();
|
12 | 13 |
|
13 | 14 | const forge = inject(DEFAULT_FORGE_FACTORY);
|
14 |
| - const gitLabState = inject(GITLAB_STATE); |
| 15 | + const gitLabState = injectOptional(GITLAB_STATE, null); |
15 | 16 | const determinedForgeType = forge.determinedForgeType;
|
16 |
| - const token = gitLabState.token; |
17 |
| - const forkProjectId = gitLabState.forkProjectId; |
18 |
| - const upstreamProjectId = gitLabState.upstreamProjectId; |
19 |
| - const instanceUrl = gitLabState.instanceUrl; |
| 17 | + const token = gitLabState?.token ?? writable<string | undefined>(''); |
| 18 | + const forkProjectId = gitLabState?.forkProjectId ?? writable<string | undefined>(''); |
| 19 | + const upstreamProjectId = gitLabState?.upstreamProjectId ?? writable<string | undefined>(''); |
| 20 | + const instanceUrl = gitLabState?.instanceUrl ?? writable<string | undefined>(''); |
20 | 21 |
|
21 | 22 | const projectsService = inject(PROJECTS_SERVICE);
|
22 | 23 | const projectResult = $derived(projectsService.getProject(projectId));
|
|
0 commit comments