diff --git a/apps/desktop/layer/renderer/src/modules/command/commands/entry.tsx b/apps/desktop/layer/renderer/src/modules/command/commands/entry.tsx index ff968cb67..23e76a661 100644 --- a/apps/desktop/layer/renderer/src/modules/command/commands/entry.tsx +++ b/apps/desktop/layer/renderer/src/modules/command/commands/entry.tsx @@ -44,12 +44,14 @@ const category: CommandCategory = "category.entry" const useCollect = () => { const { t } = useTranslation() return useMutation({ - mutationFn: async ({ entryId, view }: { entryId: string; view: FeedViewType }) => - collectionSyncService.starEntry({ + mutationFn: async ({ entryId, view }: { entryId: string; view: FeedViewType }) => { + const { isCollection } = getRouteParams() + return collectionSyncService.starEntry({ entryId, view, - }), - + invalidate: !isCollection, + }) + }, onSuccess: () => { toast.success(t("entry_actions.starred"), { duration: 1000, diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryListHeader.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryListHeader.tsx index eeca7e1e6..52e9ff8b1 100644 --- a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryListHeader.tsx +++ b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryListHeader.tsx @@ -16,7 +16,7 @@ import { useNavigate } from "react-router" import { previewBackPath } from "~/atoms/preview" import { useGeneralSettingKey } from "~/atoms/settings/general" import { useTimelineColumnShow } from "~/atoms/sidebar" -import { FEED_COLLECTION_LIST, ROUTE_ENTRY_PENDING } from "~/constants" +import { ROUTE_ENTRY_PENDING } from "~/constants" import { useFollow } from "~/hooks/biz/useFollow" import { getRouteParams, useRouteParams } from "~/hooks/biz/useRouteParams" import { COMMAND_ID } from "~/modules/command/commands/id" @@ -43,13 +43,11 @@ export const EntryListHeader: FC<{ const unreadOnly = useGeneralSettingKey("unreadOnly") - const { feedId, entryId, view } = routerParams + const { feedId, entryId, view, isCollection } = routerParams const isPreview = useIsPreviewFeed() const headerTitle = useFeedHeaderTitle() - const isInCollectionList = feedId === FEED_COLLECTION_LIST - const titleInfo = !!headerTitle && (
@@ -83,7 +81,7 @@ export const EntryListHeader: FC<{
))} - runCmdFn(COMMAND_ID.timeline.unreadOnly, [!unreadOnly])()} - > - {unreadOnly ? ( - - ) : ( - - )} - - + {!isCollection && ( + <> + runCmdFn(COMMAND_ID.timeline.unreadOnly, [!unreadOnly])()} + > + {unreadOnly ? ( + + ) : ( + + )} + + + + )}
)}
diff --git a/packages/internal/store/src/collection/store.ts b/packages/internal/store/src/collection/store.ts index 1557aaea6..20e97d863 100644 --- a/packages/internal/store/src/collection/store.ts +++ b/packages/internal/store/src/collection/store.ts @@ -24,7 +24,15 @@ const get = useCollectionStore.getState const set = useCollectionStore.setState class CollectionSyncService { - async starEntry({ entryId, view }: { entryId: string; view: FeedViewType }) { + async starEntry({ + entryId, + view, + invalidate, + }: { + entryId: string + view: FeedViewType + invalidate?: boolean + }) { const entry = getEntry(entryId) if (!entry) { return @@ -54,7 +62,9 @@ class CollectionSyncService { await tx.run() - invalidateEntriesQuery({ collection: true }) + if (invalidate) { + invalidateEntriesQuery({ collection: true }) + } } async unstarEntry({ entryId, invalidate = true }: { entryId: string; invalidate?: boolean }) {