Skip to content

Commit ce6599f

Browse files
authored
[CLNP-7892]Fix a bug where autoscrollMessageOverflowToTop set on SendbirdProvider was not being passed down to child components (#1380)
// PR title (Required) [fix]: Fix a bug where `autoscrollMessageOverflowToTop` set on `SendbirdProvider` was not being passed down to child components. // PR description (Optional) Add a brief description of the changes in this PR. Bullet points are also fine. // Footer (Recommended) Fixes [CLNP-7892](https://sendbird.atlassian.net/browse/CLNP-7892) // Changelogs (Recommended) ### Changelogs - Fix a bug where autoscrollMessageOverflowToTop set on SendbirdProvider was not being passed down to child components ### Checklist Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If unsure, ask the members. This is a reminder of what we look for before merging your code. - [x] **All tests pass locally with my changes** - [ ] **I have added tests that prove my fix is effective or that my feature works** - [ ] **Public components / utils / props are appropriately exported** - [ ] I have added necessary documentation (if appropriate) ## External Contributions This project is not yet set up to accept pull requests from external contributors. If you have a pull request that you believe should be accepted, please contact the Developer Relations team <developer-advocates@sendbird.com> with details and we'll evaluate if we can set up a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) to allow for the contribution. [CLNP-7892]: https://sendbird.atlassian.net/browse/CLNP-7892?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent eb42316 commit ce6599f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/modules/GroupChannel/context/GroupChannelProvider.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ const GroupChannelManager :React.FC<React.PropsWithChildren<GroupChannelProvider
166166

167167
const { isScrollBottomReached } = state;
168168

169+
const isAutoscrollMessageOverflowToTop = autoscrollMessageOverflowToTop ?? config.autoscrollMessageOverflowToTop ?? false;
170+
169171
// Configuration resolution
170172
const resolvedReplyType = getCaseResolvedReplyType(moduleReplyType ?? config.groupChannel.replyType).upperCase;
171173
const resolvedThreadReplySelectType = getCaseResolvedThreadReplySelectType(
@@ -227,7 +229,7 @@ const GroupChannelManager :React.FC<React.PropsWithChildren<GroupChannelProvider
227229
// even though the next messages and the current messages length are the same.
228230
// So added this condition to check if they are the same to prevent unnecessary calling scrollToBottom action
229231
&& messages.length !== state.messages.length) {
230-
if (!autoscrollMessageOverflowToTop) {
232+
if (!isAutoscrollMessageOverflowToTop) {
231233
setTimeout(async () => actions.scrollToBottom(true), 10);
232234
} else {
233235
actions.setNewMessageIds(messages.map(it => it.messageId));
@@ -347,7 +349,7 @@ const GroupChannelManager :React.FC<React.PropsWithChildren<GroupChannelProvider
347349
isReactionEnabled: resolvedIsReactionEnabled,
348350
isMessageGroupingEnabled,
349351
isMultipleFilesMessageEnabled,
350-
autoscrollMessageOverflowToTop: autoscrollMessageOverflowToTop ?? false,
352+
autoscrollMessageOverflowToTop: autoscrollMessageOverflowToTop ?? config.autoscrollMessageOverflowToTop ?? false,
351353
replyType: resolvedReplyType,
352354
threadReplySelectType: resolvedThreadReplySelectType,
353355
showSearchIcon: showSearchIcon ?? config.groupChannelSettings.enableMessageSearch,
@@ -364,6 +366,7 @@ const GroupChannelManager :React.FC<React.PropsWithChildren<GroupChannelProvider
364366
disableMarkAsRead,
365367
scrollBehavior,
366368
config.groupChannelSettings.enableMessageSearch,
369+
config.autoscrollMessageOverflowToTop,
367370
]);
368371

369372
const scrollState = useMemo(() => ({

0 commit comments

Comments
 (0)