From 75456d18d7c1286b19c7e018bf9e4d5472bdb1b4 Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Thu, 29 Aug 2024 18:45:13 +0200 Subject: [PATCH] fix: type errors --- src/components/Chat/hooks/useChat.ts | 2 +- .../Threads/ThreadList/ThreadListLoadingIndicator.tsx | 7 +++---- .../Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx | 5 ++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Chat/hooks/useChat.ts b/src/components/Chat/hooks/useChat.ts index d3f0e45c8..b275db6d1 100644 --- a/src/components/Chat/hooks/useChat.ts +++ b/src/components/Chat/hooks/useChat.ts @@ -68,7 +68,7 @@ export const useChat = < client.threads.registerSubscriptions(); return () => { - client.threads.deregisterSubscriptions(); + client.threads.unregisterSubscriptions(); }; }, [client]); diff --git a/src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx b/src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx index f3dbbeb3a..da9da4ea4 100644 --- a/src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx +++ b/src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx @@ -6,15 +6,14 @@ import { LoadingIndicator as DefaultLoadingIndicator } from '../../Loading'; import { useChatContext, useComponentContext } from '../../../context'; import { useStateStore } from '../hooks/useStateStore'; -const selector = (nextValue: ThreadManagerState) => [nextValue.loadingNextPage]; +const selector = (nextValue: ThreadManagerState) => [nextValue.pagination.isLoadingNext]; export const ThreadListLoadingIndicator = () => { const { LoadingIndicator = DefaultLoadingIndicator } = useComponentContext(); const { client } = useChatContext(); - const [loadingNextPage] = useStateStore(client.threads.state, selector); + const [isLoadingNext] = useStateStore(client.threads.state, selector); - // TODO: figure out both loading directions once applicable (maybe Virtuoso context?) - if (!loadingNextPage) return null; + if (!isLoadingNext) return null; return (
diff --git a/src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx b/src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx index d280a1760..5d2178002 100644 --- a/src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx +++ b/src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx @@ -18,7 +18,10 @@ export const ThreadListUnseenThreadsBanner = () => {
{/* TODO: translate */} {unseenThreadIds.length} unread threads -