Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Aug 29, 2024
1 parent bd094cc commit 75456d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/Chat/hooks/useChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const useChat = <
client.threads.registerSubscriptions();

return () => {
client.threads.deregisterSubscriptions();
client.threads.unregisterSubscriptions();
};
}, [client]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className='str-chat__thread-list-loading-indicator'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const ThreadListUnseenThreadsBanner = () => {
<div className='str-chat__unseen-threads-banner'>
{/* TODO: translate */}
{unseenThreadIds.length} unread threads
<button className='str-chat__unseen-threads-banner__button' onClick={client.threads.reload}>
<button
className='str-chat__unseen-threads-banner__button'
onClick={() => client.threads.reload()}
>
<Icon.Reload />
</button>
</div>
Expand Down

0 comments on commit 75456d1

Please sign in to comment.