File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
workspace/[workspaceId]/home/hooks Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ export async function GET(request: NextRequest) {
4141 updatedAt : copilotChats . updatedAt ,
4242 conversationId : copilotChats . conversationId ,
4343 lastSeenAt : copilotChats . lastSeenAt ,
44- messageCount : sql < number > `jsonb_array_length(${ copilotChats . messages } )` . as ( 'message_count' ) ,
44+ messageCount : sql < number > `jsonb_array_length(${ copilotChats . messages } )`
45+ . mapWith ( Number )
46+ . as ( 'message_count' ) ,
4547 } )
4648 . from ( copilotChats )
4749 . where (
Original file line number Diff line number Diff line change @@ -412,8 +412,6 @@ export function useChat(
412412 options ?: UseChatOptions
413413) : UseChatReturn {
414414 const router = useRouter ( )
415- const routerRef = useRef ( router )
416- routerRef . current = router
417415 const queryClient = useQueryClient ( )
418416 const [ messages , setMessages ] = useState < ChatMessage [ ] > ( [ ] )
419417 const [ isSending , setIsSending ] = useState ( false )
@@ -1098,7 +1096,7 @@ export function useChat(
10981096 } )
10991097 }
11001098 if ( ! workflowIdRef . current ) {
1101- routerRef . current . replace ( `/workspace/${ workspaceId } /task/${ parsed . chatId } ` )
1099+ router . replace ( `/workspace/${ workspaceId } /task/${ parsed . chatId } ` )
11021100 abortControllerRef . current ?. abort ( )
11031101 streamGenRef . current ++
11041102 }
@@ -2083,6 +2081,7 @@ export function useChat(
20832081 [
20842082 workspaceId ,
20852083 queryClient ,
2084+ router ,
20862085 processSSEStream ,
20872086 finalize ,
20882087 resumeOrFinalize ,
Original file line number Diff line number Diff line change @@ -198,8 +198,7 @@ async function createTask(workspaceId: string): Promise<{ id: string }> {
198198}
199199
200200/**
201- * Creates an empty mothership chat task and invalidates the task list.
202- * Pre-warms the chat detail cache so the new chat page renders instantly with no fetch.
201+ * Pre-warms the detail cache so navigation to the new task renders without a loading flash.
203202 */
204203export function useCreateTask ( ) {
205204 const queryClient = useQueryClient ( )
You can’t perform that action at this time.
0 commit comments