Skip to content

Commit a3f06a2

Browse files
authored
fix: Include metaArray to messages when reconnecting (#897)
## Issue [CLNP-1779](https://sendbird.atlassian.net/browse/CLNP-1779) ## Fix * Include `metaArray` to the message list when fetching messages again by connecting ## ChangeLog * Resolve `NaN` message on VoiceMessage after reconnection [CLNP-1779]: https://sendbird.atlassian.net/browse/CLNP-1779?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 4e680d1 commit a3f06a2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/hooks/VoicePlayer/useVoicePlayer.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ export const useVoicePlayer = ({
7070
play: playVoicePlayer,
7171
pause: pauseVoicePlayer,
7272
stop: stopVoicePlayer,
73-
playbackTime: currentAudioUnit.playbackTime * 1000,
74-
duration: currentAudioUnit.duration * 1000,
75-
// the unit of playbackTime and duration should be millisecond
73+
/**
74+
* The reason why we multiply this by *1000 is,
75+
* The unit of playbackTime and duration should be millisecond
76+
*/
77+
playbackTime: (currentAudioUnit?.playbackTime || 0) * 1000,
78+
duration: (currentAudioUnit?.duration || 0) * 1000,
7679
playingStatus: currentAudioUnit.playingStatus,
7780
});
7881
};

src/lib/hooks/useOnlineStatus.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function useOnlineStatus(sdk: SendbirdChat, logger: LoggerInterface) {
2020
onReconnectStarted() {
2121
setIsOnline(false);
2222
logger.warning('onReconnectStarted', { isOnline });
23-
2423
},
2524
onReconnectSucceeded() {
2625
setIsOnline(true);

src/modules/Channel/context/hooks/useHandleReconnect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function useHandleReconnect(
5454
prevResultSize: PREV_RESULT_SIZE,
5555
isInclusive: true,
5656
includeReactions: isReactionEnabled,
57+
includeMetaArray: true,
5758
nextResultSize: NEXT_RESULT_SIZE,
5859
};
5960
if (replyType && replyType === 'QUOTE_REPLY') {

0 commit comments

Comments
 (0)