Skip to content

Commit b954535

Browse files
Post-merge fixes
1 parent 29017df commit b954535

21 files changed

+108
-167
lines changed

src/components/Channel/channelState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type ChannelStateReducerAction =
2323
type: 'copyStateFromChannelOnEvent';
2424
}
2525
| {
26-
channel: Channel<StreamChatGenerics>;
26+
channel: Channel;
2727
highlightedMessageId: string;
2828
type: 'jumpToMessageFinished';
2929
}

src/components/ChannelList/ChannelList.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
1+
import React, { useCallback, useEffect, useRef, useState } from 'react';
22
import clsx from 'clsx';
3+
import type { ReactNode} from 'react';
34
import type {
45
Channel,
56
ChannelFilters,
@@ -12,7 +13,10 @@ import type {
1213
import { useConnectionRecoveredListener } from './hooks/useConnectionRecoveredListener';
1314
import { useMobileNavigation } from './hooks/useMobileNavigation';
1415
import { usePaginatedChannels } from './hooks/usePaginatedChannels';
15-
import { useChannelListShape, usePrepareShapeHandlers } from './hooks/useChannelListShape';
16+
import {
17+
useChannelListShape,
18+
usePrepareShapeHandlers,
19+
} from './hooks/useChannelListShape';
1620
import { useStateStore } from '../../store';
1721
import { ChannelListMessenger } from './ChannelListMessenger';
1822
import { Avatar as DefaultAvatar } from '../Avatar';
@@ -21,7 +25,11 @@ import { ChannelSearch as DefaultChannelSearch } from '../ChannelSearch/ChannelS
2125
import { EmptyStateIndicator as DefaultEmptyStateIndicator } from '../EmptyStateIndicator';
2226
import { LoadingChannels } from '../Loading/LoadingChannels';
2327
import { LoadMorePaginator } from '../LoadMore/LoadMorePaginator';
24-
import { ChannelListContextProvider, useChatContext, useComponentContext } from '../../context';
28+
import {
29+
ChannelListContextProvider,
30+
useChatContext,
31+
useComponentContext,
32+
} from '../../context';
2533
import { NullComponent } from '../UtilityComponents';
2634
import { MAX_QUERY_CHANNELS_LIMIT, moveChannelUpwards } from './utils';
2735
import type { CustomQueryChannelsFn } from './hooks/usePaginatedChannels';

src/components/ChannelPreview/ChannelPreview.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import throttle from 'lodash.throttle';
2-
import React, { ReactNode, useEffect, useMemo, useState } from 'react';
2+
import React, { useEffect, useMemo, useState } from 'react';
3+
import type { ReactNode} from 'react';
4+
import type { Channel, Event } from 'stream-chat';
35

46
import { ChannelPreviewMessenger } from './ChannelPreviewMessenger';
57
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
68
import { useChannelPreviewInfo } from './hooks/useChannelPreviewInfo';
79
import { getLatestMessagePreview as defaultGetLatestMessagePreview } from './utils';
8-
9-
import type { ChatContextValue } from '../../context/ChatContext';
1010
import { useChatContext } from '../../context/ChatContext';
1111
import { useTranslationContext } from '../../context/TranslationContext';
12-
import type { MessageDeliveryStatus } from './hooks/useMessageDeliveryStatus';
1312
import { useMessageDeliveryStatus } from './hooks/useMessageDeliveryStatus';
14-
15-
import type { Channel, Event } from 'stream-chat';
16-
13+
import type { MessageDeliveryStatus } from './hooks/useMessageDeliveryStatus';
14+
import type { ChatContextValue } from '../../context/ChatContext';
1715
import type { ChannelAvatarProps } from '../Avatar/ChannelAvatar';
1816
import type { GroupChannelDisplayInfo } from './utils';
1917
import type { StreamMessage } from '../../context/ChannelStateContext';

src/components/ChannelPreview/ChannelPreviewMessenger.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import clsx from 'clsx';
44
import { ChannelPreviewActionButtons as DefaultChannelPreviewActionButtons } from './ChannelPreviewActionButtons';
55
import { Avatar as DefaultAvatar } from '../Avatar';
66
import { useComponentContext } from '../../context';
7-
87
import type { ChannelPreviewUIComponentProps } from './ChannelPreview';
9-
import type { DefaultStreamChatGenerics } from '../../types/types';
108

119
const UnMemoizedChannelPreviewMessenger = (props: ChannelPreviewUIComponentProps) => {
1210
const {

src/components/ChannelPreview/utils.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import React, { ReactNode } from 'react';
2-
1+
import React from 'react';
32
import ReactMarkdown from 'react-markdown';
4-
3+
import type { ReactNode } from 'react';
54
import type { Channel, PollVote, TranslationLanguages, UserResponse } from 'stream-chat';
65

76
import type { TranslationContextValue } from '../../context/TranslationContext';
8-
97
import type { ChatContextValue } from '../../context';
108

119
export const renderPreviewText = (text: string) => (

src/components/MessageList/renderMessages.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import type { ReactNode } from 'react';
21
import React, { Fragment } from 'react';
3-
2+
import type { ReactNode } from 'react';
43
import type { UserResponse } from 'stream-chat';
54

6-
import type { GroupStyle } from './utils';
75
import { getIsFirstUnreadMessage, isDateSeparatorMessage } from './utils';
86
import { Message } from '../Message';
97
import { DateSeparator as DefaultDateSeparator } from '../DateSeparator';
108
import { EventComponent as DefaultMessageSystem } from '../EventComponent';
119
import { UnreadMessagesSeparator as DefaultUnreadMessagesSeparator } from './UnreadMessagesSeparator';
12-
import type { ComponentContextValue, CustomClasses } from '../../context';
1310
import { CUSTOM_MESSAGE_TYPE } from '../../constants/messageTypes';
14-
11+
import type { ComponentContextValue, CustomClasses } from '../../context';
12+
import type { GroupStyle } from './utils';
1513
import type { ChannelUnreadUiState } from '../../types';
1614
import type { StreamMessage } from '../../context/ChannelStateContext';
1715
import type { MessageProps } from '../Message';

src/context/ChannelStateContext.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type { PropsWithChildren } from 'react';
21
import React, { useContext } from 'react';
3-
2+
import type { PropsWithChildren } from 'react';
43
import type {
4+
APIErrorResponse,
55
Channel,
66
ChannelConfigWithInfo,
7+
ErrorFromResponse,
78
MessageResponse,
89
Mute,
910
ChannelState as StreamChannelState,
@@ -24,10 +25,15 @@ export type ChannelNotifications = Array<{
2425
type: 'success' | 'error';
2526
}>;
2627

27-
export type StreamMessage = (
28-
| ReturnType<StreamChannelState['formatMessage']>
29-
| MessageResponse
30-
) & { customType?: string; errorStatusCode?: number; editing?: boolean; date?: Date };
28+
export type StreamMessage =
29+
// FIXME: we should use only one of the two (either formatted or unformatted)
30+
(ReturnType<StreamChannelState['formatMessage']> | MessageResponse) & {
31+
customType?: string;
32+
errorStatusCode?: number;
33+
error?: ErrorFromResponse<APIErrorResponse>;
34+
editing?: boolean;
35+
date?: Date;
36+
};
3137

3238
export type ChannelState = {
3339
suppressAutoscroll: boolean;

src/context/ChatContext.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import type { PropsWithChildren } from 'react';
21
import React, { useContext } from 'react';
3-
4-
import { getDisplayName } from './utils/getDisplayName';
5-
2+
import type { PropsWithChildren } from 'react';
63
import type {
74
AppSettingsAPIResponse,
85
Channel,
96
Mute,
107
SearchController,
118
} from 'stream-chat';
9+
10+
import { getDisplayName } from './utils/getDisplayName';
1211
import type { ChatProps } from '../components/Chat/Chat';
1312
import type { UnknownType } from '../types/types';
1413
import type { ChannelsQueryState } from '../components/Chat/hooks/useChannelsQueryState';
@@ -27,7 +26,7 @@ type CSSClasses =
2726

2827
export type CustomClasses = Partial<Record<CSSClasses, string>>;
2928

30-
type ChannelCID = string; // e.g.: "messaging:general"
29+
type ChannelConfId = string; // e.g.: "messaging:general"
3130

3231
export type ChatContextValue = {
3332
/**
@@ -36,11 +35,11 @@ export type ChatContextValue = {
3635
channelsQueryState: ChannelsQueryState;
3736
closeMobileNav: () => void;
3837
getAppSettings: () => Promise<AppSettingsAPIResponse> | null;
39-
latestMessageDatesByChannels: Record<ChannelCID, Date>;
38+
latestMessageDatesByChannels: Record<ChannelConfId, Date>;
4039
mutes: Array<Mute>;
4140
openMobileNav: () => void;
4241
/** Instance of SearchController class that allows to control all the search operations. */
43-
searchController: SearchController<StreamChatGenerics>;
42+
searchController: SearchController;
4443
/**
4544
* Sets active channel to be rendered within Channel component.
4645
* @param newChannel

src/context/ComponentContext.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ import type {
5151
UnreadMessagesNotificationProps,
5252
UnreadMessagesSeparatorProps,
5353
} from '../components';
54-
55-
import {
54+
import type {
5655
SearchProps,
5756
SearchResultsPresearchProps,
5857
SearchSourceResultListProps,

src/context/DialogManagerContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { PropsWithChildren } from 'react';
21
import React, { useContext, useState } from 'react';
2+
import type { PropsWithChildren } from 'react';
3+
34
import { DialogManager } from '../components/Dialog/DialogManager';
45
import { DialogPortalDestination } from '../components/Dialog/DialogPortal';
56

0 commit comments

Comments
 (0)