This commit is contained in:
marzban-dev
2025-01-13 21:16:03 +03:30
parent 9dc09b5d26
commit b1883eff9b
@@ -14,7 +14,8 @@ const { isOpen } = inject("isOpen") as any;
// state
const id = ref(1);
const route = useRoute();
const id = route.params.id as string | number;
const chatContainerEl = ref<HTMLElement | null>(null);
@@ -25,17 +26,17 @@ const {
isPending: isChatPending,
isFetchingNextPage: isNextChatPagePending,
hasNextPage: hasMoreChat,
fetchNextPage: loadMoreChat,
fetchNextPage: loadMoreChat
} = useGetChat(id, isOpen);
const isCreateMessagePending = useIsMutating({
mutationKey: [MUTATION_KEYS.create_chat],
mutationKey: [MUTATION_KEYS.create_chat]
});
const canLoadMoreChat = ref(false);
const isChatScrollLocked = useScrollLock(chatContainerEl);
const { y: chatContainerScrollY } = useScroll(chatContainerEl, {
behavior: "smooth",
behavior: "smooth"
});
useInfiniteScroll(
@@ -52,7 +53,7 @@ useInfiniteScroll(
distance: 10,
direction: "top",
throttle: 1000,
canLoadMore: () => canLoadMoreChat.value,
canLoadMore: () => canLoadMoreChat.value
}
);
@@ -112,7 +113,7 @@ whenever(
}, 2000);
},
{
once: true,
once: true
}
);
</script>