From cd024e45d3cd6689aa49030e79e79c19a2dd5249 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 7 Apr 2025 19:38:08 +0800 Subject: [PATCH] fix(mobile): remove prefetching of entry translations - Removed `usePrefetchEntryTranslation` calls from `EntryGridFooter`, `EntryNormalItem`, and `EntrySocialItem` components to optimize performance and reduce unnecessary data fetching. Signed-off-by: Innei --- apps/mobile/src/modules/entry-content/EntryGridFooter.tsx | 4 ++-- .../src/modules/entry-list/templates/EntryNormalItem.tsx | 3 +-- .../src/modules/entry-list/templates/EntrySocialItem.tsx | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/mobile/src/modules/entry-content/EntryGridFooter.tsx b/apps/mobile/src/modules/entry-content/EntryGridFooter.tsx index 994c5886f..3c83b1652 100644 --- a/apps/mobile/src/modules/entry-content/EntryGridFooter.tsx +++ b/apps/mobile/src/modules/entry-content/EntryGridFooter.tsx @@ -9,7 +9,7 @@ import { FeedIcon } from "@/src/components/ui/icon/feed-icon" import { gentleSpringPreset } from "@/src/constants/spring" import { useEntry } from "@/src/store/entry/hooks" import { useFeed } from "@/src/store/feed/hooks" -import { useEntryTranslation, usePrefetchEntryTranslation } from "@/src/store/translation/hooks" +import { useEntryTranslation } from "@/src/store/translation/hooks" import { useEntryListContextView } from "../entry-list/EntryListContext" import { EntryTranslation } from "../entry-list/templates/EntryTranslation" @@ -22,7 +22,7 @@ export const EntryGridFooter = ({ descriptionClassName?: string }) => { const entry = useEntry(entryId) - usePrefetchEntryTranslation(entryId) + const translation = useEntryTranslation(entryId) const feed = useFeed(entry?.feedId || "") const view = useEntryListContextView() diff --git a/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx b/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx index b085cf5be..123f76e69 100644 --- a/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx +++ b/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx @@ -24,7 +24,7 @@ import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]" import { useEntry } from "@/src/store/entry/hooks" import { getInboxFrom } from "@/src/store/entry/utils" import { useFeed } from "@/src/store/feed/hooks" -import { useEntryTranslation, usePrefetchEntryTranslation } from "@/src/store/translation/hooks" +import { useEntryTranslation } from "@/src/store/translation/hooks" import { EntryItemContextMenu } from "../../context-menu/entry" import { EntryItemSkeleton } from "../EntryListContentArticle" @@ -33,7 +33,6 @@ import { EntryTranslation } from "./EntryTranslation" export function EntryNormalItem({ entryId, extraData }: { entryId: string; extraData: string }) { const entry = useEntry(entryId) - usePrefetchEntryTranslation(entryId) const translation = useEntryTranslation(entryId) const from = getInboxFrom(entry) const feed = useFeed(entry?.feedId as string) diff --git a/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx b/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx index bb50c95ff..46715c56a 100644 --- a/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx +++ b/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx @@ -19,7 +19,7 @@ import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]" import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" import { useEntry } from "@/src/store/entry/hooks" import { useFeed } from "@/src/store/feed/hooks" -import { useEntryTranslation, usePrefetchEntryTranslation } from "@/src/store/translation/hooks" +import { useEntryTranslation } from "@/src/store/translation/hooks" import { unreadSyncService } from "@/src/store/unread/store" import { EntryItemContextMenu } from "../../context-menu/entry" @@ -28,7 +28,6 @@ import { EntryTranslation } from "./EntryTranslation" export function EntrySocialItem({ entryId }: { entryId: string }) { const entry = useEntry(entryId) - usePrefetchEntryTranslation(entryId) const translation = useEntryTranslation(entryId) const feed = useFeed(entry?.feedId || "")