# channel.lastMessage is not cleared properly

**URL:** <https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679>\
**Category:** JavaScript\
**Tags:** chatsdk\
**Created:** [December 4, 2023, 10:17am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679 "2023-12-04T10:17:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleksii\_Ablitsov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/oleksii_ablitsov/32/4760_2.png) [@Oleksii\_Ablitsov](https://community.sendbird.com/u/Oleksii_Ablitsov)\
**Post date:** [December 4, 2023, 10:17am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/1 "2023-12-04T10:17:30Z")

</div>

**[Problem/Question]**  
// Detailed description of issue.  
channel.lastMessage is not cleared properly when last message deleted

* * *

// If problem, please fill out the below. If question, please delete.  
**[SDK Version]**  
// What version of the SDK are you using?  
Version which you use here sendbirdcom/products/demos/community

**[Reproduction Steps]**  
// Please provide reproduction steps and, if possible, code snippets.

[![](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/1/1a0045c59fb6ac9b31504c34e3ef92b365e907a6.jpeg "Sendbird channel.lastMessage but") ](https://www.youtube.com/watch?v=Z5Au-zkcHRI)

**[Frequency]**  
// How frequently is this issue occurring?  
always

**[Current impact]**  
// How is this currently impacting your implementation?  
We see deleted message in the chat preview.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [December 11, 2023, 6:33am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/2 "2023-12-11T06:33:51Z")

</div>

I’m unable to reproduce this on an up to date instance of the UIKit. Bug testing should be done in an update version of the UIKit using something like StackBlitz or CodeSandBox

---

<div class="post-metadata">

**Author:** ![Thang\_Ly](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thang_ly/32/5736_2.png) [@Thang\_Ly](https://community.sendbird.com/u/Thang_Ly)\
**Post date:** [February 10, 2025, 7:48am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/3 "2025-02-10T07:48:07Z")

</div>

The same error with me

---

<div class="post-metadata">

**Author:** ![Thang\_Ly](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thang_ly/32/5736_2.png) [@Thang\_Ly](https://community.sendbird.com/u/Thang_Ly)\
**Post date:** [February 10, 2025, 7:55am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/4 "2025-02-10T07:55:24Z")

</div>

Please delete message of channel which have only a message, error will be happen when channel empty.

---

<div class="post-metadata">

**Author:** ![Thang\_Ly](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thang_ly/32/5736_2.png) [@Thang\_Ly](https://community.sendbird.com/u/Thang_Ly)\
**Post date:** [February 10, 2025, 8:16am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/5 "2025-02-10T08:16:41Z")

</div>

This is my code.

 ![code](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/0/020387106ba7d130078050c50941a93ab5eee9e0.png)

Please take a look for the video bellow

> **[Screen Recording 2025-02-10 at 15.13.42.mov](https://drive.google.com/file/d/1Fi0VQbhcXgtoLjKelbGpGuwPsiWCT2Lo/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [February 11, 2025, 2:25am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/6 "2025-02-11T02:25:01Z")

</div>

What version of the SDK or UIKit are you using?

---

<div class="post-metadata">

**Author:** ![Thang\_Ly](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thang_ly/32/5736_2.png) [@Thang\_Ly](https://community.sendbird.com/u/Thang_Ly)\
**Post date:** [February 11, 2025, 2:37am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/7 "2025-02-11T02:37:07Z")

</div>

I’m using JavaScript SDK 4.16.4 with React 18.2.0

---

<div class="post-metadata">

**Author:** ![Danney\_Chun](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/danney_chun/32/643_2.png) [@Danney\_Chun](https://community.sendbird.com/u/Danney_Chun)\
**Post date:** [February 12, 2025, 2:53am UTC](https://community.sendbird.com/t/channel-lastmessage-is-not-cleared-properly/8679/8 "2025-02-12T02:53:22Z")

</div>

It seems to be SDK bug, and we will fix it at v4.16.5
