# Ucaught TypeError: Cannot read properties of undefined (reading 'scrollTop')

**URL:** <https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166>\
**Category:** React\
**Tags:** javascript, uikit\
**Created:** [April 27, 2023, 2:34pm UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166 "2023-04-27T14:34:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dror\_Elgabsi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/dror_elgabsi/32/842_2.png) [@Dror\_Elgabsi](https://community.sendbird.com/u/Dror_Elgabsi)\
**Post date:** [April 27, 2023, 2:34pm UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/1 "2023-04-27T14:34:17Z")

</div>

**[Problem]**  
UI kit doesn’t load previus messages on the latest version (3.4.6)

> act-dom.development.js:4312 Uncaught TypeError: Cannot read properties of undefined (reading ‘scrollTop’)  
> at onScroll (index.tsx:67:16)  
> at index.ts:41:7  
> at HTMLUnknownElement.callCallback2 (react-dom.development.js:4164:14)  
> at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16)  
> at invokeGuardedCallback (react-dom.development.js:4277:31)  
> at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:25)  
> at executeDispatch (react-dom.development.js:9041:3)  
> at processDispatchQueueItemsInOrder (react-dom.development.js:9073:7)  
> at processDispatchQueue (react-dom.development.js:9086:5)  
> at dispatchEventsForPlugins (react-dom.development.js:9097:3)

path to file:

> /node\_modules/@sendbird/src/smart-components/Channel/components/MessageList/index.tsx

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/4/472e3a9c86d3c1525093b46a2df8e79e0bb3dd9f.png)

* * *

tested on both 3.4.5/6 versions  
**[“@sendbird/uikit-react”: “3.4.5”]**  
**[“@sendbird/uikit-react”: “3.4.6”]**  
**[“@sendbird/chat”: “^4.2.2”]**

**[Reproduction Steps]**  
install the latest UI kit  
select a channel with more than 30 - 40 messages  
scroll to the top of the message list  
error in the console + no additional messages gets loaded

**[Frequency]**  
every time the message list needs to load more messages

**[Current impact]**  
can not use this version UI kit is broken

---

<div class="post-metadata">

**Author:** ![Dror\_Elgabsi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/dror_elgabsi/32/842_2.png) [@Dror\_Elgabsi](https://community.sendbird.com/u/Dror_Elgabsi)\
**Post date:** [April 30, 2023, 6:53am UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/2 "2023-04-30T06:53:06Z")

</div>

> [@Dror\_Elgabsi](#):
>
> [“@sendbird/uikit-react”: “3.4.5”]

**[“@sendbird/uikit-react”: “3.4.5”]**  
works after reset local cache

---

<div class="post-metadata">

**Author:** ![Sungwoo\_Jo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/sungwoo_jo/32/3957_2.png) [@Sungwoo\_Jo](https://community.sendbird.com/u/Sungwoo_Jo)\
**Post date:** [May 1, 2023, 3:03am UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/3 "2023-05-01T03:03:45Z")

</div>

I am experiencing the same bug.

I think this code might be the issue.

> <https://github.com/sendbird/sendbird-uikit-react/blob/c3348217bbe73b2b31ed3261ceaa13ac64c6c0db/src/smart-components/Channel/components/MessageList/index.tsx#L62>

I think it should be

```auto
const element = scrollRef.current;

```

---

<div class="post-metadata">

**Author:** ![Dror\_Elgabsi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/dror_elgabsi/32/842_2.png) [@Dror\_Elgabsi](https://community.sendbird.com/u/Dror_Elgabsi)\
**Post date:** [May 1, 2023, 6:24am UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/4 "2023-05-01T06:24:37Z")

</div>

I would patch it locally but the package is minified :\

---

<div class="post-metadata">

**Author:** ![jkepps](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/jkepps/32/1156_2.png) [@jkepps](https://community.sendbird.com/u/jkepps)\
**Post date:** [May 1, 2023, 8:41pm UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/5 "2023-05-01T20:41:22Z")

</div>

I’m seeing the same issue here

edit: downgrading to 3.4.4 seems to have resolved the issue

---

<div class="post-metadata">

**Author:** ![Alex\_Preston](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/alex_preston/32/167_2.png) [@Alex\_Preston](https://community.sendbird.com/u/Alex_Preston)\
**Post date:** [May 22, 2023, 3:38pm UTC](https://community.sendbird.com/t/ucaught-typeerror-cannot-read-properties-of-undefined-reading-scrolltop/7166/6 "2023-05-22T15:38:09Z")

</div>

Hey all @jkepps @Dror_Elgabsi @Sungwoo_Jo this was fixed in 3.4.7!
