perf(app): restore preloading channels and guilds on hover (#3208)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-04 19:46:49 +02:00
1 parent 12a407aca8
commit 532e828fe6
7 files changed
+222 -13

No files matched your search

@@ -5,6 +5,7 @@ import {LongPressable} from '@app/features/app/components/LongPressable';
import {getChannelUnreadState} from '@app/features/app/components/layout/utils/ChannelUnreadState';
import {CustomStatusDisplay} from '@app/features/app/components/shared/custom_status_display/CustomStatusDisplay';
import {GroupDMAvatar} from '@app/features/app/components/shared/GroupDMAvatar';
import {useChannelHoverPreload} from '@app/features/app/hooks/useChannelHoverPreload';
import {useContextMenuHoverState} from '@app/features/app/hooks/useContextMenuHoverState';
import {UserTag} from '@app/features/channel/components/ChannelUserTag';
import styles from '@app/features/channel/components/direct_message/DirectMessageList.module.css';
@@ -198,9 +199,15 @@ const ResolvedDMListItem = observer(function ResolvedDMListItem({
leaveGroup,
i18n,
});
const {scheduleChannelPreload, cancelChannelPreload, preloadChannelNow} = useChannelHoverPreload({
channel,
guild: null,
preloadMemberList: false,
});
const handleNavigate = useCallback(() => {
preloadChannelNow();
handlers.navigateTo();
}, [handlers.navigateTo]);
}, [handlers.navigateTo, preloadChannelNow]);
const mobileMenuGroups = buildMobileMenuGroups({
channel,
recipient,
@@ -500,6 +507,8 @@ const ResolvedDMListItem = observer(function ResolvedDMListItem({
)}
onClick={handleNavigate}
onContextMenu={handleContextMenu}
onMouseEnter={scheduleChannelPreload}
onMouseLeave={cancelChannelPreload}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
data-dm-list-focus-item="true"