@@ -963,8 +963,6 @@ export function useChat(
963963 const recoveringClientWorkflowToolIdsRef = useRef < Set < string > > ( new Set ( ) )
964964 const executionStream = useExecutionStream ( )
965965 const isHomePage = pathname . endsWith ( '/home' )
966- const wasHomePageRef = useRef ( isHomePage )
967- const pendingHomeResetRef = useRef ( false )
968966
969967 const setTransportIdle = useCallback ( ( ) => {
970968 sendingRef . current = false
@@ -1219,33 +1217,10 @@ export function useChat(
12191217 ] )
12201218
12211219 useEffect ( ( ) => {
1222- const wasHomePage = wasHomePageRef . current
1223- wasHomePageRef . current = isHomePage
1224-
1225- if ( ! isHomePage ) {
1226- pendingHomeResetRef . current = false
1227- return
1228- }
1229- if ( workflowIdRef . current || ! chatIdRef . current ) return
1230-
1231- const shouldHandleHomeReset = pendingHomeResetRef . current || ! wasHomePage
1232- if ( ! shouldHandleHomeReset ) return
1233-
1234- const hasActiveTransport =
1235- isSending ||
1236- sendingRef . current ||
1237- isReconnecting ||
1238- abortControllerRef . current !== null ||
1239- streamReaderRef . current !== null
1240-
1241- if ( hasActiveTransport ) {
1242- pendingHomeResetRef . current = true
1243- return
1244- }
1245-
1246- pendingHomeResetRef . current = false
1220+ if ( workflowIdRef . current ) return
1221+ if ( ! isHomePage || ! chatIdRef . current ) return
12471222 resetHomeChatState ( )
1248- } , [ isHomePage , isReconnecting , isSending , resetHomeChatState ] )
1223+ } , [ isHomePage , resetHomeChatState ] )
12491224
12501225 useEffect ( ( ) => {
12511226 if ( ! chatHistory ) return
0 commit comments