11import { Outlet , createFileRoute , redirect } from "@tanstack/react-router" ;
22import { useAtomValue } from "@effect/atom-react" ;
3- import { scopedThreadKey } from "@t3tools/client-runtime/environment" ;
4- import {
5- isAtomCommandInterrupted ,
6- squashAtomCommandFailure ,
7- } from "@t3tools/client-runtime/state/runtime" ;
8- import { effectiveSettled } from "@t3tools/client-runtime/state/thread-settled" ;
93import { useEffect , useMemo } from "react" ;
104
115import { isCommandPaletteOpen } from "../commandPaletteBus" ;
126import { useClientSettings , useLegacySidebarEnabled } from "../hooks/useSettings" ;
137import { openCommandPalette } from "../commandPaletteBus" ;
14- import { readEnvironmentSupportsSettlement , readThreadShell , useProjects } from "../state/entities" ;
8+ import { useProjects } from "../state/entities" ;
159import { usePrimaryEnvironmentId } from "../state/environments" ;
1610import { selectProjectGroupingSettings } from "../logicalProject" ;
1711import { buildSidebarProjectSnapshots } from "../sidebarProjectGrouping" ;
1812import { dispatchPreviewAction } from "../components/preview/previewActionBus" ;
1913import { useHandleNewThread } from "../hooks/useHandleNewThread" ;
20- import { useThreadActions } from "../hooks/useThreadActions" ;
2114import { startNewThreadFromContext } from "../lib/chatThreadActions" ;
2215import { isPreviewFocused } from "../lib/previewFocus" ;
2316import { isTerminalFocused } from "../lib/terminalFocus" ;
@@ -26,8 +19,6 @@ import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../termina
2619import { isPreviewSupportedInRuntime } from "../previewStateStore" ;
2720import { selectActiveRightPanel , useRightPanelStore } from "../rightPanelStore" ;
2821import { useThreadSelectionStore } from "../threadSelectionStore" ;
29- import { threadChangeRequestSnapshotsAtom } from "../components/ThreadStatusIndicators" ;
30- import { appAtomRegistry } from "../rpc/atomRegistry" ;
3122import { stackedThreadToast , toastManager } from "~/components/ui/toast" ;
3223import { primaryServerKeybindingsAtom } from "~/state/server" ;
3324
@@ -36,12 +27,9 @@ function ChatRouteGlobalShortcuts() {
3627 const selectedThreadKeysSize = useThreadSelectionStore ( ( state ) => state . selectedThreadKeys . size ) ;
3728 const { activeDraftThread, activeThread, defaultProjectRef, handleNewThread, routeThreadRef } =
3829 useHandleNewThread ( ) ;
39- const { settleThread, unsettleThread } = useThreadActions ( ) ;
4030 const keybindings = useAtomValue ( primaryServerKeybindingsAtom ) ;
4131 const legacySidebarEnabled = useLegacySidebarEnabled ( ) ;
4232 const projectGroupingSettings = useClientSettings ( selectProjectGroupingSettings ) ;
43- const autoSettleAfterDays = useClientSettings ( ( settings ) => settings . sidebarAutoSettleAfterDays ) ;
44- const autoSettleOnMerge = useClientSettings ( ( settings ) => settings . sidebarAutoSettleOnMerge ) ;
4533 const projects = useProjects ( ) ;
4634 const primaryEnvironmentId = usePrimaryEnvironmentId ( ) ;
4735 const projectGroupCount = useMemo (
@@ -120,45 +108,6 @@ function ChatRouteGlobalShortcuts() {
120108 return ;
121109 }
122110
123- if ( command === "thread.settle" ) {
124- event . preventDefault ( ) ;
125- event . stopPropagation ( ) ;
126- if ( ! routeThreadRef ) return ;
127- if ( ! readEnvironmentSupportsSettlement ( routeThreadRef . environmentId ) ) return ;
128-
129- const thread = readThreadShell ( routeThreadRef ) ;
130- if ( ! thread ) return ;
131-
132- const snapshot = appAtomRegistry
133- . get ( threadChangeRequestSnapshotsAtom )
134- . get ( scopedThreadKey ( routeThreadRef ) ) ;
135- const changeRequest =
136- snapshot != null && ( thread . worktreePath === null || snapshot . branch === thread . branch )
137- ? snapshot . pr
138- : null ;
139- const settled = effectiveSettled ( thread , {
140- now : `${ new Date ( ) . toISOString ( ) . slice ( 0 , 16 ) } :00.000Z` ,
141- autoSettleAfterDays,
142- autoSettleOnMerge,
143- changeRequest,
144- } ) ;
145-
146- void ( settled ? unsettleThread ( routeThreadRef ) : settleThread ( routeThreadRef ) ) . then (
147- ( result ) => {
148- if ( result . _tag !== "Failure" || isAtomCommandInterrupted ( result ) ) return ;
149- const error = squashAtomCommandFailure ( result ) ;
150- toastManager . add (
151- stackedThreadToast ( {
152- type : "error" ,
153- title : settled ? "Failed to un-settle thread" : "Failed to settle thread" ,
154- description : error instanceof Error ? error . message : "An error occurred." ,
155- } ) ,
156- ) ;
157- } ,
158- ) ;
159- return ;
160- }
161-
162111 if ( command === "preview.toggle" ) {
163112 event . preventDefault ( ) ;
164113 event . stopPropagation ( ) ;
@@ -210,8 +159,6 @@ function ChatRouteGlobalShortcuts() {
210159 } , [
211160 activeDraftThread ,
212161 activeThread ,
213- autoSettleAfterDays ,
214- autoSettleOnMerge ,
215162 clearSelection ,
216163 handleNewThread ,
217164 keybindings ,
@@ -220,10 +167,8 @@ function ChatRouteGlobalShortcuts() {
220167 projectGroupCount ,
221168 routeThreadRef ,
222169 selectedThreadKeysSize ,
223- settleThread ,
224170 legacySidebarEnabled ,
225171 terminalOpen ,
226- unsettleThread ,
227172 ] ) ;
228173
229174 return null ;
0 commit comments