diff --git a/apps/renderer/src/components/ui/context-menu/context-menu.tsx b/apps/renderer/src/components/ui/context-menu/context-menu.tsx index d96396edf..1cec540a9 100644 --- a/apps/renderer/src/components/ui/context-menu/context-menu.tsx +++ b/apps/renderer/src/components/ui/context-menu/context-menu.tsx @@ -99,7 +99,7 @@ const ContextMenuCheckboxItem = React.forwardRef< { if (!feed) return [] diff --git a/apps/renderer/src/modules/feed-column/category.tsx b/apps/renderer/src/modules/feed-column/category.tsx index 10ba1c023..34e90892e 100644 --- a/apps/renderer/src/modules/feed-column/category.tsx +++ b/apps/renderer/src/modules/feed-column/category.tsx @@ -16,7 +16,7 @@ import type { FeedViewType } from "~/lib/enum" import { showNativeMenu } from "~/lib/native-menu" import { cn, sortByAlphabet } from "~/lib/utils" import { getPreferredTitle, useAddFeedToFeedList, useFeedStore } from "~/store/feed" -import { useListByView } from "~/store/list" +import { useOwnedList } from "~/store/list" import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription" import { useFeedUnreadStore } from "~/store/unread" @@ -131,7 +131,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego const addMutation = useAddFeedToFeedList() - const listList = useListByView(view!) + const listList = useOwnedList(view!) return (
diff --git a/apps/renderer/src/store/list/hooks.ts b/apps/renderer/src/store/list/hooks.ts index 05e75e90d..6c24c5ba9 100644 --- a/apps/renderer/src/store/list/hooks.ts +++ b/apps/renderer/src/store/list/hooks.ts @@ -1,3 +1,6 @@ +import { useMemo } from "react" + +import { useWhoami } from "~/atoms/user" import type { FeedViewType } from "~/lib/enum" import type { ListModel } from "~/models" @@ -9,3 +12,12 @@ export const useListById = (listId: Nullable): ListModel | null => export const useListByView = (view: FeedViewType) => { return useListStore((state) => Object.values(state.lists).filter((list) => list.view === view)) } + +export const useOwnedList = (view: FeedViewType) => { + const whoami = useWhoami() + const viewLists = useListByView(view) + return useMemo( + () => viewLists.filter((list) => list.ownerUserId === whoami?.id), + [viewLists, whoami], + ) +}