Skip to content

Commit

Permalink
fix: localeCompare is undefined
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Nov 11, 2024
1 parent 6f1eb26 commit ab28156
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apps/renderer/src/initialize/sentry.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const ERROR_PATTERNS = [
"HTTP Client Error",
// Biz errors
"Chain aborted",
"The database connection is closing",
"NotSupportedError",
]

export const SentryConfig: BrowserOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -15,6 +15,23 @@ export const SortByAlphabeticalFeedList = ({
data,
categoryOpenStateData,
}: FeedListProps) => {
const feedId2CategoryMap = useSubscriptionStore((state) => {
const map = {} as Record<string, string>
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<string, string>
for (const categoryName in data) {
Expand All @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit ab28156

Please sign in to comment.