Skip to content

Commit 7d5afdd

Browse files
committed
Remove unused UI and uncommitted injections; inject services in drop handler
Remove unused UI_STATE and UNCOMMITTED_SERVICE injections from BranchList.svelte and instead inject them directly where needed in dropHandler.ts. This cleans up unused imports and simplifies component props by moving the service injections into StartCommitDzHandler, ensuring the drop handler has direct access to uiState and uncommittedService without passing them through the BranchList component.
1 parent bb2d673 commit 7d5afdd

2 files changed

Lines changed: 7 additions & 17 deletions

File tree

apps/desktop/src/components/BranchList.svelte

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
import { REORDER_DROPZONE_FACTORY } from "$lib/dragging/stackingReorderDropzoneManager";
2121
import { DEFAULT_FORGE_FACTORY } from "$lib/forge/forgeFactory.svelte";
2222
import { createBranchSelection } from "$lib/selection/key";
23-
import { UNCOMMITTED_SERVICE } from "$lib/selection/uncommittedService.svelte";
2423
import { getStackContext } from "$lib/stack/stackController.svelte";
2524
import { type BranchDetails } from "$lib/stacks/stack";
2625
import { STACK_SERVICE } from "$lib/stacks/stackService.svelte";
2726
import { combineResults } from "$lib/state/helpers";
28-
import { UI_STATE } from "$lib/state/uiState.svelte";
2927
import { URL_SERVICE } from "$lib/utils/url";
3028
import { ensureValue } from "$lib/utils/validation";
3129
import { inject } from "@gitbutler/core/context";
@@ -40,15 +38,11 @@
4038
const { branches }: Props = $props();
4139
4240
const controller = getStackContext();
43-
const uiState = inject(UI_STATE);
4441
const stackService = inject(STACK_SERVICE);
4542
const forge = inject(DEFAULT_FORGE_FACTORY);
4643
const urlService = inject(URL_SERVICE);
4744
const baseBranchService = inject(BASE_BRANCH_SERVICE);
4845
const claudeCodeService = inject(CLAUDE_CODE_SERVICE);
49-
const uncommittedService = inject(UNCOMMITTED_SERVICE);
50-
51-
// Reactive aliases for template readability (passed to leaf components)
5246
const projectId = $derived(controller.projectId);
5347
const stackId = $derived(controller.stackId);
5448
const laneId = $derived(controller.laneId);
@@ -142,13 +136,7 @@
142136
{@const codegenQuery = stackId
143137
? claudeCodeService.messages({ projectId, stackId })
144138
: undefined}
145-
{@const startCommittingDz = new StartCommitDzHandler(
146-
uiState,
147-
uncommittedService,
148-
projectId,
149-
stackId,
150-
branchName,
151-
)}
139+
{@const startCommittingDz = new StartCommitDzHandler(projectId, stackId, branchName)}
152140
{#if stackId}
153141
<BranchInsertion
154142
{projectId}

apps/desktop/src/lib/branches/dropHandler.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { FileChangeDropData, FolderChangeDropData, HunkDropDataV3 } from "$lib/dragging/draggables";
22
import { updateStackPrs } from "$lib/forge/shared/prFooter";
3+
import { UNCOMMITTED_SERVICE } from "$lib/selection/uncommittedService.svelte";
4+
import { UI_STATE } from "$lib/state/uiState.svelte";
5+
import { inject } from "@gitbutler/core/context";
36
import type { DropzoneHandler } from "$lib/dragging/handler";
47
import type { ForgePrService } from "$lib/forge/interface/forgePrService";
5-
import type { UncommittedService } from "$lib/selection/uncommittedService.svelte";
68
import type { StackService } from "$lib/stacks/stackService.svelte";
7-
import type { UiState } from "$lib/state/uiState.svelte";
89

910
export class BranchDropData {
1011
constructor(
@@ -67,9 +68,10 @@ export class MoveBranchDzHandler implements DropzoneHandler {
6768
}
6869

6970
export class StartCommitDzHandler implements DropzoneHandler {
71+
private readonly uiState = inject(UI_STATE);
72+
private readonly uncommittedService = inject(UNCOMMITTED_SERVICE);
73+
7074
constructor(
71-
private readonly uiState: UiState,
72-
private readonly uncommittedService: UncommittedService,
7375
private readonly projectId: string,
7476
private readonly stackId: string | undefined,
7577
private readonly branchName: string,

0 commit comments

Comments
 (0)