Skip to content

Commit

Permalink
feat: compatible with feeds without siteURL
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Aug 28, 2024
1 parent 085f30d commit 87dc225
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/renderer/src/components/feed-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ export function FeedIcon({
)
break
}
default: {
ImageElement = (
<i
className="i-mgc-link-cute-re mr-2 shrink-0"
style={{
width: size,
height: size,
}}
/>
)
break
}
}

const colors = useMemo(
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/queries/feed.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ROUTE_FEED_PENDING } from "@renderer/constants"
import { useAuthQuery } from "@renderer/hooks/common"
import { apiClient, getFetchErrorMessage } from "@renderer/lib/api-fetch"
import { defineQuery } from "@renderer/lib/defineQuery"
Expand Down Expand Up @@ -44,7 +45,7 @@ export const useFeed = ({ id, url }: FeedQueryParams) =>
url,
}),
{
enabled: !!id || !!url,
enabled: (!!id || !!url) && id !== ROUTE_FEED_PENDING,
},
)

Expand Down
11 changes: 7 additions & 4 deletions src/renderer/src/store/subscription/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ function morphResponseData(data: SubscriptionModel[]): SubscriptionFlatModel[] {
const cloned: SubscriptionFlatModel = { ...subscription }
if (!subscription.category && subscription.feeds) {
const { siteUrl } = subscription.feeds
if (!siteUrl) continue
const parsed = parse(siteUrl)
if (!siteUrl) {
cloned.defaultCategory = subscription.feedId
} else {
const parsed = parse(siteUrl)

if (parsed.domain) {
cloned.defaultCategory = capitalizeFirstLetter(parsed.domain)
if (parsed.domain) {
cloned.defaultCategory = capitalizeFirstLetter(parsed.domain)
}
}
}
result.push(cloned)
Expand Down

0 comments on commit 87dc225

Please sign in to comment.