Avoid incorrect use of preload cache

This commit is contained in:
trevor-signal
2025-10-28 14:46:38 -04:00
committed by GitHub
parent 11d5880d1d
commit a2aab8c920
2 changed files with 15 additions and 8 deletions

View File

@@ -1571,7 +1571,7 @@ export class ConversationModel {
// The message is being sent before the user has scrolled down to load the newest // 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 // messages into memory; in that case, we scroll the user all the way down by
// loading the newest message // loading the newest message
drop(this.loadNewestMessages(newestId, undefined)); drop(this.loadNewestMessages(message.id, undefined));
} else if ( } else if (
// The message has to be not a story or has to be a story reply in direct // The message has to be not a story or has to be a story reply in direct
// conversation. // conversation.

View File

@@ -294,12 +294,6 @@ const getModeSpecificProps = (
} }
}; };
function preloadConversation(conversationId: string): void {
drop(
window.ConversationController.get(conversationId)?.preloadNewestMessages()
);
}
async function saveAlerts(alerts: ServerAlertsType): Promise<void> { async function saveAlerts(alerts: ServerAlertsType): Promise<void> {
await itemStorage.put('serverAlerts', alerts); await itemStorage.put('serverAlerts', alerts);
} }
@@ -402,6 +396,19 @@ export const SmartLeftPane = memo(function SmartLeftPane({
}); });
}, [changeLocation]); }, [changeLocation]);
const maybePreloadConversation = useCallback(
(conversationId: string) => {
if (conversationId !== selectedConversationId) {
drop(
window.ConversationController.get(
conversationId
)?.preloadNewestMessages()
);
}
},
[selectedConversationId]
);
let hasExpiredDialog = false; let hasExpiredDialog = false;
let unsupportedOSDialogType: 'error' | 'warning' | undefined; let unsupportedOSDialogType: 'error' | 'warning' | undefined;
if (hasAppExpired) { if (hasAppExpired) {
@@ -469,7 +476,7 @@ export const SmartLeftPane = memo(function SmartLeftPane({
otherTabsUnreadStats={otherTabsUnreadStats} otherTabsUnreadStats={otherTabsUnreadStats}
pauseBackupMediaDownload={pauseBackupMediaDownload} pauseBackupMediaDownload={pauseBackupMediaDownload}
preferredWidthFromStorage={preferredWidthFromStorage} preferredWidthFromStorage={preferredWidthFromStorage}
preloadConversation={preloadConversation} preloadConversation={maybePreloadConversation}
removeConversation={removeConversation} removeConversation={removeConversation}
renderCaptchaDialog={renderCaptchaDialog} renderCaptchaDialog={renderCaptchaDialog}
renderCrashReportDialog={renderCrashReportDialog} renderCrashReportDialog={renderCrashReportDialog}