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