mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
Pinned Messages: Fix broken order after switching chats
This commit is contained in:
parent
8faf3a84f5
commit
84f8b64040
@ -134,15 +134,16 @@ const MiddleHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
}
|
||||
}, [chatId, loadPinnedMessages, lastSyncTime, threadId]);
|
||||
|
||||
useEffect(() => {
|
||||
setPinnedMessageIndex(0);
|
||||
}, [chatId]);
|
||||
|
||||
// Modify index after unpinning
|
||||
// Modify pinned index after unpinning
|
||||
useEffect(() => {
|
||||
setPinnedMessageIndex(pinnedMessagesCount ? cycleRestrict(pinnedMessagesCount, pinnedMessageIndex) : -1);
|
||||
}, [pinnedMessagesCount, pinnedMessageIndex]);
|
||||
|
||||
// Reset pinned index when switching chats
|
||||
useEffect(() => {
|
||||
setPinnedMessageIndex(0);
|
||||
}, [chatId]);
|
||||
|
||||
useEnsureMessage(chatId, pinnedMessageId, pinnedMessage);
|
||||
|
||||
const { width: windowWidth } = useWindowSize();
|
||||
|
Loading…
x
Reference in New Issue
Block a user