diff --git a/apps/renderer/src/initialize/sentry.config.ts b/apps/renderer/src/initialize/sentry.config.ts index 04f566048c..a66a4c23d0 100644 --- a/apps/renderer/src/initialize/sentry.config.ts +++ b/apps/renderer/src/initialize/sentry.config.ts @@ -16,6 +16,8 @@ const ERROR_PATTERNS = [ "HTTP Client Error", // Biz errors "Chain aborted", + "The database connection is closing", + "NotSupportedError", ] export const SentryConfig: BrowserOptions = { diff --git a/apps/renderer/src/modules/feed-column/sort-by/SortByAlphabeticalList.tsx b/apps/renderer/src/modules/feed-column/sort-by/SortByAlphabeticalList.tsx index f9d7ca9219..7097c4df4f 100644 --- a/apps/renderer/src/modules/feed-column/sort-by/SortByAlphabeticalList.tsx +++ b/apps/renderer/src/modules/feed-column/sort-by/SortByAlphabeticalList.tsx @@ -3,7 +3,7 @@ import { Fragment } from "react" import { INBOX_PREFIX_ID } from "~/constants" import { getPreferredTitle, useFeedStore } from "~/store/feed" -import { getSubscriptionByFeedId } from "~/store/subscription" +import { useSubscriptionStore } from "~/store/subscription" import { useFeedListSortSelector } from "../atom" import { FeedCategory } from "../category" @@ -15,6 +15,23 @@ export const SortByAlphabeticalFeedList = ({ data, categoryOpenStateData, }: FeedListProps) => { + const feedId2CategoryMap = useSubscriptionStore((state) => { + const map = {} as Record + for (const categoryName in data) { + const feedId = data[categoryName][0] + if (!feedId) { + continue + } + const subscription = state.data[feedId] + if (!subscription) { + continue + } + if (subscription.category) { + map[feedId] = subscription.category + } + } + return map + }) const categoryName2RealDisplayNameMap = useFeedStore((state) => { const map = {} as Record for (const categoryName in data) { @@ -27,7 +44,7 @@ export const SortByAlphabeticalFeedList = ({ if (!feed) { continue } - const hascategoryNameNotDefault = !!getSubscriptionByFeedId(feedId)?.category + const hascategoryNameNotDefault = !!feedId2CategoryMap[feedId] const isSingle = data[categoryName].length === 1 if (!isSingle || hascategoryNameNotDefault) { map[categoryName] = categoryName @@ -43,6 +60,9 @@ export const SortByAlphabeticalFeedList = ({ let sortedByAlphabetical = Object.keys(data).sort((a, b) => { const nameA = categoryName2RealDisplayNameMap[a] const nameB = categoryName2RealDisplayNameMap[b] + if (typeof nameA !== "string" || typeof nameB !== "string") { + return 0 + } return sortByAlphabet(nameA, nameB) }) if (!isDesc) {