Skip to content

Commit 2ba89a7

Browse files
Fix lint
1 parent 7780dc7 commit 2ba89a7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

apps/sim/app/api/mothership/chats/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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(

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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,

apps/sim/hooks/queries/tasks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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
*/
204203
export function useCreateTask() {
205204
const queryClient = useQueryClient()

0 commit comments

Comments
 (0)