fix(app): resolve the unread anchor where channel message loads originate (#1701)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-17 16:20:49 +02:00
1 parent 97c29bf1fb
commit c35d29ea0b
3 files changed
+37 -8

No files matched your search

@@ -4,6 +4,7 @@ import type {Channel} from '@app/features/channel/models/Channel';
import type {Guild} from '@app/features/guild/models/Guild';
import {ensureMembersForMessages} from '@app/features/messaging/commands/MessageCommands';
import Messages from '@app/features/messaging/state/MessagingMessages';
import ReadStates from '@app/features/read_state/state/ReadStates';
import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';
import {useCallback, useEffect, useRef} from 'react';
@@ -56,7 +57,8 @@ export function useChannelHoverPreload({
return;
}
if (preloadMessages) {
if (!Messages.preloadLatestPage(channel.id, guild?.id ?? channel.guildId ?? null)) {
const unreadAnchor = ReadStates.getUnreadJumpAnchor(channel.id);
if (!Messages.preloadLatestPage(channel.id, guild?.id ?? channel.guildId ?? null, unreadAnchor)) {
ensureMembersForCachedChannelMessages(channel.id);
}
}