Skip to content

Commit fd104d0

Browse files
committed
fix: show delete category action when available
1 parent c3abc06 commit fd104d0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/renderer/src/modules/discover/feed-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ const FeedInnerForm = ({
243243

244244
onSuccess?.()
245245
},
246-
async onError(err) {
246+
onError(err) {
247247
toastFetchError(err)
248248
},
249249
})

apps/renderer/src/modules/feed-column/category.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import { LoadingCircle } from "~/components/ui/loading"
1010
import { ROUTE_FEED_IN_FOLDER, views } from "~/constants"
1111
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
1212
import { getRouteParams, useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
13-
import { useAnyPointDown, useInputComposition } from "~/hooks/common"
13+
import { useAnyPointDown, useAuthQuery, useInputComposition } from "~/hooks/common"
1414
import { stopPropagation } from "~/lib/dom"
1515
import type { FeedViewType } from "~/lib/enum"
1616
import { showNativeMenu } from "~/lib/native-menu"
1717
import { cn, sortByAlphabet } from "~/lib/utils"
18+
import { subscription as subscriptionQuery } from "~/queries/subscriptions"
1819
import { getPreferredTitle, useAddFeedToFeedList, useFeedStore } from "~/store/feed"
1920
import { useOwnedList } from "~/store/list"
2021
import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription"
@@ -132,6 +133,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego
132133
const addMutation = useAddFeedToFeedList()
133134

134135
const listList = useOwnedList(view!)
136+
const categories = useAuthQuery(subscriptionQuery.categories())
135137

136138
return (
137139
<div tabIndex={-1} onClick={stopPropagation}>
@@ -219,7 +221,8 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego
219221
{
220222
type: "text",
221223
label: t("sidebar.feed_column.context_menu.delete_category"),
222-
click: async () => {
224+
hide: !folderName || !categories.data?.includes(folderName),
225+
click: () => {
223226
present({
224227
title: t("sidebar.feed_column.context_menu.delete_category_confirmation", {
225228
folderName,

0 commit comments

Comments
 (0)