{item.content}
@@ -177,31 +179,19 @@ function List() {
className="relative h-full py-2 [&>div]:!flex [&>div]:flex-col [&>div]:justify-end [&>div]:min-h-full"
>
- {isLoading || !data ? (
+ {isLoading ? (
<>
-
-
- {time(Math.floor(Date.now() / 1000))}
-
+
+
-
-
- {time(Math.floor(Date.now() / 1000))}
-
+
+
>
) : isError ? (
@@ -211,7 +201,21 @@ function List() {
) : (
- data.map((item, idx) => renderItem(item, idx))
+ data.map((item) => (
+
+
+ {item[0]}
+
+
+ {item[1]
+ .sort((a, b) => a.created_at - b.created_at)
+ .map((item, idx) => renderItem(item, idx))}
+
+
+ ))
)}
diff --git a/src/routes/$account.chats.lazy.tsx b/src/routes/$account.chats.lazy.tsx
index 6e3b14c..b67154c 100644
--- a/src/routes/$account.chats.lazy.tsx
+++ b/src/routes/$account.chats.lazy.tsx
@@ -67,7 +67,7 @@ function ChatList() {
const { isLoading, data } = useQuery({
queryKey: ["chats"],
queryFn: async () => {
- const res = await commands.getChats(true);
+ const res = await commands.getChats();
if (res.status === "ok") {
const raw = res.data;
@@ -79,11 +79,20 @@ function ChatList() {
}
},
select: (data) => data.sort((a, b) => b.created_at - a.created_at),
- refetchOnWindowFocus: false,
});
useEffect(() => {
- const unlisten = listen