Skip to content

Commit eae627c

Browse files
committed
Add replaceBranchInStackSelection helper
Add a new function replaceBranchInStackSelection to update the branchName in StackSelection objects if they match a given old branch name. This utility supports consistent updating of branch selection state when branch names change.
1 parent f434341 commit eae627c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apps/desktop/src/lib/state/uiState.svelte.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,14 @@ export function replaceBranchInExclusiveAction(
267267
return action;
268268
}
269269
}
270+
271+
export function replaceBranchInStackSelection(
272+
selection: StackSelection,
273+
oldBranchName: string,
274+
branchName: string
275+
): StackSelection {
276+
if (selection.branchName === oldBranchName) {
277+
return { ...selection, branchName };
278+
}
279+
return selection;
280+
}

0 commit comments

Comments
 (0)