diff --git a/front/lib/api/assistant/conversation.ts b/front/lib/api/assistant/conversation.ts index 3f7d3d45fab9..ef3498492813 100644 --- a/front/lib/api/assistant/conversation.ts +++ b/front/lib/api/assistant/conversation.ts @@ -229,6 +229,7 @@ export async function getUserConversations( } const participations = await ConversationParticipant.findAll({ + attributes: [], where: { userId: user.id, action: "posted", @@ -240,7 +241,6 @@ export async function getUserConversations( required: true, }, ], - order: [["createdAt", "DESC"]], }); const conversations = participations.reduce( diff --git a/front/lib/swr/conversations.ts b/front/lib/swr/conversations.ts index 4c2c1e2e7158..34f6ad790789 100644 --- a/front/lib/swr/conversations.ts +++ b/front/lib/swr/conversations.ts @@ -5,6 +5,7 @@ import type { ConversationType, LightWorkspaceType, } from "@dust-tt/types"; +import _ from "lodash"; import { useCallback, useMemo } from "react"; import type { Fetcher } from "swr"; @@ -58,7 +59,10 @@ export function useConversations({ workspaceId }: { workspaceId: string }) { ); return { - conversations: useMemo(() => (data ? data.conversations : []), [data]), + conversations: useMemo( + () => (data ? _.sortBy(data.conversations, "createdAt").reverse() : []), + [data] + ), isConversationsLoading: !error && !data, isConversationsError: error, mutateConversations: mutate,