Pinned Messages: Load only after sync (#3684)
This commit is contained in:
parent
4a2b7eb7fd
commit
1ca9fdcff8
@ -106,6 +106,7 @@ type StateProps = {
|
||||
currentTransitionKey: number;
|
||||
connectionState?: GlobalState['connectionState'];
|
||||
isSyncing?: boolean;
|
||||
isSynced?: boolean;
|
||||
isFetchingDifference?: boolean;
|
||||
};
|
||||
|
||||
@ -133,6 +134,7 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
||||
currentTransitionKey,
|
||||
connectionState,
|
||||
isSyncing,
|
||||
isSynced,
|
||||
isFetchingDifference,
|
||||
getCurrentPinnedIndexes,
|
||||
getLoadingPinnedId,
|
||||
@ -166,10 +168,10 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
||||
const isForum = chat?.isForum;
|
||||
|
||||
useEffect(() => {
|
||||
if (isReady && (threadId === MAIN_THREAD_ID || isForum)) {
|
||||
if (isSynced && isReady && (threadId === MAIN_THREAD_ID || isForum)) {
|
||||
loadPinnedMessages({ chatId, threadId });
|
||||
}
|
||||
}, [chatId, threadId, isReady, isForum]);
|
||||
}, [chatId, threadId, isSynced, isReady, isForum]);
|
||||
|
||||
useEnsureMessage(chatId, pinnedMessageId, pinnedMessage);
|
||||
|
||||
@ -526,6 +528,7 @@ export default memo(withGlobal<OwnProps>(
|
||||
currentTransitionKey: Math.max(0, messageLists.length - 1),
|
||||
connectionState: global.connectionState,
|
||||
isSyncing: global.isSyncing,
|
||||
isSynced: global.isSynced,
|
||||
isFetchingDifference: global.isFetchingDifference,
|
||||
hasButtonInHeader: canStartBot || canRestartBot || canSubscribe || shouldSendJoinRequest,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user