Skip to content

Commit aa4add7

Browse files
authored
fix: broken CSS in the ParentMessageInfo component (#1204)
#### Changelog * Fixed broken CSS in Thread: * Style was not applied to `ParentMessageInfo` until the first message was received on the thread list. * Scroll functionality was not working on the thread list. #### Fix * Use `channelState`, `parentMessageState` and `threadListState` to calculate the loading status in `useMessageLayoutDirection` * Fix typo for className
1 parent d320f82 commit aa4add7

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/modules/Thread/components/ParentMessageInfo/ParentMessageInfoItem.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
width: 56px;
8181
}
8282

83-
.sendbird-parent-message-info-item__thumbnail-message__image-cover {;
83+
.sendbird-parent-message-info-item__thumbnail-message__image-cover {
8484
background-color: var(--sendbird-light-overlay-01);
8585
border-radius: 16px;
8686
display: none;

src/modules/Thread/components/ThreadUI/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const ThreadUI: React.FC<ThreadUIProps> = ({
149149
)
150150
}
151151
<div
152-
className={classnames('sendbird-thread-ui--scroll, sendbird-conversation__messages')}
152+
className={classnames('sendbird-thread-ui--scroll', 'sendbird-conversation__messages')}
153153
ref={scrollRef}
154154
onScroll={onScroll}
155155
>

src/modules/Thread/context/ThreadProvider.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import threadReducer from './dux/reducer';
1616
import { ThreadContextActionTypes } from './dux/actionTypes';
1717
import threadInitialState, { ThreadContextInitialState } from './dux/initialState';
1818

19+
import type { OnBeforeDownloadFileMessageType } from '../../GroupChannel/context/GroupChannelProvider';
1920
import useGetChannel from './hooks/useGetChannel';
2021
import useGetAllEmoji from './hooks/useGetAllEmoji';
2122
import useGetParentMessage from './hooks/useGetParentMessage';
@@ -31,8 +32,8 @@ import useSendVoiceMessageCallback from './hooks/useSendVoiceMessageCallback';
3132
import { PublishingModuleType, useSendMultipleFilesMessage } from './hooks/useSendMultipleFilesMessage';
3233
import { SendableMessageType } from '../../../utils';
3334
import { useThreadFetchers } from './hooks/useThreadFetchers';
34-
import type { OnBeforeDownloadFileMessageType } from '../../GroupChannel/context/GroupChannelProvider';
3535
import { useMessageLayoutDirection } from '../../../hooks/useHTMLTextDirection';
36+
import { ChannelStateTypes, ParentMessageStateTypes, ThreadListStateTypes } from '../types';
3637

3738
export interface ThreadProviderProps extends
3839
Pick<UserProfileProviderProps, 'disableUserProfile' | 'renderUserProfile'> {
@@ -165,8 +166,9 @@ export const ThreadProvider = (props: ThreadProviderProps) => {
165166
useMessageLayoutDirection(
166167
htmlTextDirection,
167168
forceLeftToRightMessageLayout,
168-
// we're assuming that if the thread message list is empty, it's in the loading state
169-
allThreadMessages.length === 0,
169+
channelState === ChannelStateTypes.LOADING
170+
|| threadListState === ThreadListStateTypes.LOADING
171+
|| parentMessageState === ParentMessageStateTypes.LOADING,
170172
);
171173

172174
const toggleReaction = useToggleReactionCallback({ currentChannel }, { logger });

0 commit comments

Comments
 (0)