Skip to content

Commit 9b7d544

Browse files
committed
Rename stackState -> laneState
1 parent c82d50a commit 9b7d544

14 files changed

+51
-53
lines changed

apps/desktop/src/components/BranchCard.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@
9999
exclusiveAction.branchName === branchName
100100
);
101101
102-
const stackState = $derived(
103-
args.type === 'stack-branch' ? uiState.stack(args.laneId) : undefined
104-
);
105-
const selection = $derived(stackState ? stackState.selection.current : undefined);
102+
const laneState = $derived(args.type === 'stack-branch' ? uiState.lane(args.laneId) : undefined);
103+
const selection = $derived(laneState ? laneState.selection.current : undefined);
106104
const selected = $derived(selection?.branchName === branchName);
107105
const isPushed = $derived(!!(args.type === 'draft-branch' ? undefined : args.trackingBranch));
108106

apps/desktop/src/components/BranchCommitList.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@
111111
const isCommitting = $derived(
112112
exclusiveAction?.type === 'commit' && exclusiveAction.stackId === stackId
113113
);
114-
const stackState = $derived(uiState.stack(laneId));
115-
const selection = $derived(stackState.selection);
114+
const laneState = $derived(uiState.lane(laneId));
115+
const selection = $derived(laneState.selection);
116116
const runHooks = $derived(projectRunCommitHooks(projectId));
117117
118118
const selectedBranchName = $derived(selection.current?.branchName);
@@ -156,7 +156,7 @@
156156
157157
async function handleCommitClick(commitId: string, upstream: boolean) {
158158
if (selectedCommitId !== commitId) {
159-
stackState.selection.set({ branchName, commitId, upstream });
159+
laneState.selection.set({ branchName, commitId, upstream });
160160
}
161161
projectState.stackId.set(stackId);
162162
onselect?.();
@@ -327,7 +327,7 @@
327327
stackId,
328328
$runHooks,
329329
dzCommit,
330-
(newId) => uiState.stack(stackId).selection.set({ branchName, commitId: newId }),
330+
(newId) => uiState.lane(stackId).selection.set({ branchName, commitId: newId }),
331331
uiState
332332
)
333333
: undefined}

apps/desktop/src/components/BranchList.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
const isCommitting = $derived(
5656
exclusiveAction?.type === 'commit' && exclusiveAction?.stackId === stackId
5757
);
58-
const stackState = $derived(uiState.stack(laneId));
59-
const selection = $derived(stackState.selection);
58+
const laneState = $derived(uiState.lane(laneId));
59+
const selection = $derived(laneState.selection);
6060
const selectedCommitId = $derived(selection.current?.commitId);
6161
6262
let newBranchModal = $state<ReturnType<typeof NewBranchModal>>();
@@ -70,7 +70,7 @@
7070
}
7171
7272
function startEditingCommitMessage(branchName: string, commitId: string) {
73-
stackState.selection.set({ branchName, commitId });
73+
laneState.selection.set({ branchName, commitId });
7474
projectState.exclusiveAction.set({
7575
type: 'edit-commit-message',
7676
stackId,
@@ -185,7 +185,7 @@
185185
trackingBranch={branch.remoteTrackingBranch ?? undefined}
186186
readonly={!!branch.remoteTrackingBranch}
187187
onclick={() => {
188-
uiState.stack(laneId).selection.set({ branchName });
188+
uiState.lane(laneId).selection.set({ branchName });
189189
intelligentScrollingService.show(projectId, laneId, 'details');
190190
onselect?.();
191191
}}

apps/desktop/src/components/CommitMessageEditor.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
const uncommittedService = inject(UNCOMMITTED_SERVICE);
6464
const stackService = inject(STACK_SERVICE);
6565
66-
const stackState = $derived(stackId ? uiState.stack(stackId) : undefined);
67-
const stackSelection = $derived(stackState?.selection);
66+
const laneState = $derived(stackId ? uiState.lane(stackId) : undefined);
67+
const stackSelection = $derived(laneState?.selection);
6868
6969
let composer = $state<ReturnType<typeof MessageEditor>>();
7070
let titleInput = $state<HTMLTextAreaElement>();

apps/desktop/src/components/CommitView.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
6161
const forge = inject(DEFAULT_FORGE_FACTORY);
6262
const modeService = injectOptional(MODE_SERVICE, undefined);
63-
const stackState = $derived(uiState.stack(laneId));
63+
const laneState = $derived(uiState.lane(laneId));
6464
const projectState = $derived(uiState.project(projectId));
65-
const selected = $derived(stackState.selection);
65+
const selected = $derived(laneState.selection);
6666
const branchName = $derived(selected.current?.branchName);
6767
6868
const commitResult = $derived(
@@ -123,7 +123,7 @@
123123
message: commitMessage
124124
});
125125
126-
uiState.stack(stackId).selection.set({ branchName, commitId: newCommitId });
126+
uiState.lane(stackId).selection.set({ branchName, commitId: newCommitId });
127127
setMode('view');
128128
}
129129

apps/desktop/src/components/FeedItemKind.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
3131
function selectCommit(stackId: string, branchName: string, commitId: string) {
3232
const projectState = uiState.project(projectId);
33-
const stackState = uiState.stack(stackId);
34-
stackState.selection.set({
33+
const laneState = uiState.lane(stackId);
34+
laneState.selection.set({
3535
branchName,
3636
commitId
3737
});
@@ -40,8 +40,8 @@
4040
4141
function selectBranch(stackId: string, branchName: string) {
4242
const projectState = uiState.project(projectId);
43-
const stackState = uiState.stack(stackId);
44-
stackState.selection.set({
43+
const laneState = uiState.lane(stackId);
44+
laneState.selection.set({
4545
branchName
4646
});
4747
projectState.stackId.set(stackId);

apps/desktop/src/components/FileContextMenu.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@
158158
changes: changesToDiffSpec(changes)
159159
});
160160
const newCommitId = replacedCommits.find(([before]) => before === commitId)?.[1];
161-
const branchName = uiState.stack(stackId).selection.current?.branchName;
161+
const branchName = uiState.lane(stackId).selection.current?.branchName;
162162
const selectedFiles = changes.map((change) => ({ ...selectionId, path: change.path }));
163163
164164
// Unselect the uncommitted files
165165
idSelection.removeMany(selectedFiles);
166166
167167
if (newCommitId && branchName) {
168168
// Update the selection to the new commit
169-
uiState.stack(stackId).selection.set({ branchName, commitId: newCommitId });
169+
uiState.lane(stackId).selection.set({ branchName, commitId: newCommitId });
170170
}
171171
contextMenu.close();
172172
}

apps/desktop/src/components/MultiStackView.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@
143143
`StackView` instead of being set imperatively in the dragstart handler.
144144
-->
145145
{#each mutableStacks as stack, i (stack.id)}
146-
{@const stackState = uiState.stack(stack.id)}
147-
{@const selection = stackState.selection}
146+
{@const laneState = uiState.lane(stack.id)}
147+
{@const selection = laneState.selection}
148148
<div
149149
class="reorderable-stack"
150150
role="presentation"

apps/desktop/src/components/NewCommitView.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
2727
const projectState = $derived(uiState.project(projectId));
2828
// Using a dummy stackId kind of sucks... but it's fine for now
29-
const stackState = $derived(uiState.stack(stackId || 'new-commit-view--new-stack'));
29+
const laneState = $derived(uiState.lane(stackId || 'new-commit-view--new-stack'));
3030
3131
const [createCommitInStack, commitCreation] = stackService.createCommit({});
3232
@@ -120,7 +120,7 @@
120120
121121
if (newId) {
122122
// Clear saved state for commit message editor.
123-
stackState.newCommitMessage.set({ title: '', description: '' });
123+
laneState.newCommitMessage.set({ title: '', description: '' });
124124
125125
// Close the drawer.
126126
projectState.exclusiveAction.set(undefined);
@@ -143,7 +143,7 @@
143143
projectId,
144144
targetBranchName: finalBranchName,
145145
newCommitId: newId ?? undefined,
146-
commitTitle: stackState.newCommitMessage.current?.title || '',
146+
commitTitle: laneState.newCommitMessage.current?.title || '',
147147
pathsToRejectedChanges
148148
});
149149
}
@@ -155,7 +155,7 @@
155155
const [createNewStack, newStackResult] = stackService.newStack;
156156
157157
async function handleCommitCreation(title: string, description: string) {
158-
stackState.newCommitMessage.set({ title, description });
158+
laneState.newCommitMessage.set({ title, description });
159159
160160
const message = description ? title + '\n\n' + description : title;
161161
if (!message) {
@@ -184,15 +184,15 @@
184184
}
185185
186186
if (newCommitMessageUpdate) {
187-
stackState.newCommitMessage.set({
188-
...stackState.newCommitMessage.current,
187+
laneState.newCommitMessage.set({
188+
...laneState.newCommitMessage.current,
189189
...newCommitMessageUpdate
190190
});
191191
}
192192
}
193193
194194
function cancel(args: { title: string; description: string }) {
195-
stackState.newCommitMessage.set(args);
195+
laneState.newCommitMessage.set(args);
196196
projectState.exclusiveAction.set(undefined);
197197
uncommittedService.uncheckAll(null);
198198
if (stackId) {
@@ -213,7 +213,7 @@
213213
onCancel={cancel}
214214
disabledAction={!canCommit}
215215
loading={commitCreation.current.isLoading || newStackResult.current.isLoading || isCooking}
216-
title={stackState.newCommitMessage.current.title}
217-
description={stackState.newCommitMessage.current.description}
216+
title={laneState.newCommitMessage.current.title}
217+
description={laneState.newCommitMessage.current.description}
218218
/>
219219
</div>

apps/desktop/src/components/StackView.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
9191
let dropzoneActivated = $state(false);
9292
93-
const stackState = $derived(uiState.stack(laneId));
94-
const selection = $derived(stackState.selection);
93+
const laneState = $derived(uiState.lane(laneId));
94+
const selection = $derived(laneState.selection);
9595
const assignedSelection = $derived(
9696
idSelection.getById(createWorktreeSelection({ stackId: stackId }))
9797
);
@@ -435,7 +435,7 @@
435435
}}
436436
onselect={() => {
437437
// Clear one selection when you modify the other.
438-
stackState?.selection.set(undefined);
438+
laneState?.selection.set(undefined);
439439
intelligentScrollingService.show(projectId, laneId, 'diff');
440440
}}
441441
>

0 commit comments

Comments
 (0)