Skip to content

Commit

Permalink
feat: prefetch all subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jul 16, 2024
1 parent a8607a1 commit e77c77d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/renderer/src/modules/feed-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { ProfileButton } from "@renderer/components/user-button"
import { useNavigateEntry } from "@renderer/hooks/biz/useNavigateEntry"
import { useReduceMotion } from "@renderer/hooks/biz/useReduceMotion"
import { getRouteParams } from "@renderer/hooks/biz/useRouteParams"
import { useAuthQuery } from "@renderer/hooks/common"
import { views } from "@renderer/lib/constants"
import { stopPropagation } from "@renderer/lib/dom"
import { Routes } from "@renderer/lib/enum"
import { shortcuts } from "@renderer/lib/shortcuts"
import { clamp, cn } from "@renderer/lib/utils"
import { Queries } from "@renderer/queries"
import { useSubscriptionStore } from "@renderer/store/subscription"
import { useFeedUnreadStore } from "@renderer/store/unread"
import { useWheel } from "@use-gesture/react"
Expand Down Expand Up @@ -45,6 +47,7 @@ const useBackHome = (active: number) => {
}

const useUnreadByView = () => {
useAuthQuery(Queries.subscription.byView())
const idByView = useSubscriptionStore((state) =>
state.dataIdByView,
)
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/src/store/subscription/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const get = useSubscriptionStore.getState
class SubscriptionActions {
async fetchByView(view?: FeedViewType) {
const res = await apiClient.subscriptions.$get({
query: { view: String(view) },
query: {
view: view !== undefined ? String(view) : undefined,
},
})

// reset dataIdByView
Expand Down

0 comments on commit e77c77d

Please sign in to comment.