Skip to content

Commit d0ba147

Browse files
authored
Fix quoting edited messages showing outdated text (#6107)
* Fix quoting edited messages using outdated values. * Update CHANGELOG.md.
1 parent 6fe8d53 commit d0ba147

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171

7272
## stream-chat-android-compose
7373
### 🐞 Fixed
74+
- Fix quoting edited messages showing outdated text. [#6107](https://github.com/GetStream/stream-chat-android/pull/6107)
7475

7576
### ⬆️ Improved
7677

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageItem.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import androidx.compose.runtime.getValue
4646
import androidx.compose.runtime.mutableFloatStateOf
4747
import androidx.compose.runtime.remember
4848
import androidx.compose.runtime.rememberCoroutineScope
49+
import androidx.compose.runtime.rememberUpdatedState
4950
import androidx.compose.runtime.setValue
5051
import androidx.compose.ui.Alignment
5152
import androidx.compose.ui.Alignment.Companion.BottomEnd
@@ -272,9 +273,11 @@ public fun MessageItem(
272273
ownCapabilities = messageItem.ownCapabilities,
273274
)
274275

276+
// Remember the message to ensure updated values are captured in the onReply lambda
277+
val replyMessage by rememberUpdatedState(message)
275278
SwipeToReply(
276279
modifier = modifier,
277-
onReply = { onReply(message) },
280+
onReply = { onReply(replyMessage) },
278281
isSwipeable = { isSwipable },
279282
swipeToReplyContent = swipeToReplyContent,
280283
) {

0 commit comments

Comments
 (0)