mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Avoid incorrect use of preload cache
This commit is contained in:
@@ -1571,7 +1571,7 @@ export class ConversationModel {
|
||||
// The message is being sent before the user has scrolled down to load the newest
|
||||
// messages into memory; in that case, we scroll the user all the way down by
|
||||
// loading the newest message
|
||||
drop(this.loadNewestMessages(newestId, undefined));
|
||||
drop(this.loadNewestMessages(message.id, undefined));
|
||||
} else if (
|
||||
// The message has to be not a story or has to be a story reply in direct
|
||||
// conversation.
|
||||
|
||||
@@ -294,12 +294,6 @@ const getModeSpecificProps = (
|
||||
}
|
||||
};
|
||||
|
||||
function preloadConversation(conversationId: string): void {
|
||||
drop(
|
||||
window.ConversationController.get(conversationId)?.preloadNewestMessages()
|
||||
);
|
||||
}
|
||||
|
||||
async function saveAlerts(alerts: ServerAlertsType): Promise<void> {
|
||||
await itemStorage.put('serverAlerts', alerts);
|
||||
}
|
||||
@@ -402,6 +396,19 @@ export const SmartLeftPane = memo(function SmartLeftPane({
|
||||
});
|
||||
}, [changeLocation]);
|
||||
|
||||
const maybePreloadConversation = useCallback(
|
||||
(conversationId: string) => {
|
||||
if (conversationId !== selectedConversationId) {
|
||||
drop(
|
||||
window.ConversationController.get(
|
||||
conversationId
|
||||
)?.preloadNewestMessages()
|
||||
);
|
||||
}
|
||||
},
|
||||
[selectedConversationId]
|
||||
);
|
||||
|
||||
let hasExpiredDialog = false;
|
||||
let unsupportedOSDialogType: 'error' | 'warning' | undefined;
|
||||
if (hasAppExpired) {
|
||||
@@ -469,7 +476,7 @@ export const SmartLeftPane = memo(function SmartLeftPane({
|
||||
otherTabsUnreadStats={otherTabsUnreadStats}
|
||||
pauseBackupMediaDownload={pauseBackupMediaDownload}
|
||||
preferredWidthFromStorage={preferredWidthFromStorage}
|
||||
preloadConversation={preloadConversation}
|
||||
preloadConversation={maybePreloadConversation}
|
||||
removeConversation={removeConversation}
|
||||
renderCaptchaDialog={renderCaptchaDialog}
|
||||
renderCrashReportDialog={renderCrashReportDialog}
|
||||
|
||||
Reference in New Issue
Block a user