Skip to content

Commit b164956

Browse files
committed
Read pinned threads from store at delete time
- Avoid capturing stale pinned thread IDs in thread delete actions - Read the latest pin state when computing fallback navigation
1 parent aa96bfd commit b164956

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎apps/web/src/hooks/useThreadActions.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function useThreadActions() {
2323
(store) => store.clearProjectDraftThreadById,
2424
);
2525
const clearTerminalState = useTerminalStateStore((state) => state.clearTerminalState);
26-
const pinnedThreadIds = useUiStateStore((state) => state.pinnedThreadIds);
2726
const routeThreadId = useParams({
2827
strict: false,
2928
select: (params) => (params.threadId ? ThreadId.makeUnsafe(params.threadId) : null),
@@ -113,6 +112,7 @@ export function useThreadActions() {
113112
}
114113

115114
const deletedThreadIds = opts.deletedThreadIds ?? new Set<ThreadId>();
115+
const pinnedThreadIds = useUiStateStore.getState().pinnedThreadIds;
116116
const shouldNavigateToFallback = routeThreadId === threadId;
117117
const fallbackThreadId = getFallbackThreadIdAfterDelete({
118118
threads: threads.map((entry) =>
@@ -176,7 +176,6 @@ export function useThreadActions() {
176176
clearTerminalState,
177177
appSettings.sidebarThreadSortOrder,
178178
navigate,
179-
pinnedThreadIds,
180179
removeWorktreeMutation,
181180
routeThreadId,
182181
],

0 commit comments

Comments
 (0)