Fixed some stuff

This commit is contained in:
Alois 2026-03-26 22:35:31 +00:00
commit 374b8cd4e2
4 changed files with 10 additions and 5 deletions

View file

@ -32,7 +32,7 @@ export default function ConversationProvider(props: {
React.useEffect(() => {
let active = true;
send("get_chats", {})
send("get_conversations", {})
.then((data) => {
if (active) {
setConversations(data.data.user_ids);

View file

@ -45,7 +45,7 @@ function AddConversationButton() {
return;
}
setTimeout(() => setLoading(true), 500);
const timeout = setTimeout(() => setLoading(true), 500);
send("add_conversation", {
chat_partner_name: result.data,
@ -62,7 +62,10 @@ function AddConversationButton() {
toast("error", "Failed to add conversation, check console for details");
console.error("Failed to add conversation", error);
})
.finally(() => setLoading(false));
.finally(() => {
clearTimeout(timeout);
setLoading(false);
});
}
return (

View file

@ -88,7 +88,7 @@ export const socket = {
ping_iota: z.number(),
}),
},
get_chats: {
get_conversations: {
request: z.object({}),
response: z.object({
user_ids: z.array(conversation),

View file

@ -131,7 +131,7 @@ const COMMUNICATION_TYPES = [
"change_confirm",
"confirm_receive",
"confirm_read",
"get_chats",
"get_conversations",
"get_states",
"add_community",
"remove_community",
@ -343,6 +343,8 @@ registerDataKinds({ array: "container" }, [
"communities",
"rho_connections",
"matches",
"get_conversations",
"get_communities",
]);
registerDataKinds({ array: "number" }, [