Skip to content

Commit

Permalink
fix: empty entry params to pending
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 2, 2024
1 parent 1b9fb68 commit dff5a87
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/renderer/src/hooks/biz/useNavigateEntry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getReadonlyRoute, getStableRouterNavigate } from "@renderer/atoms"
import { ROUTE_FEED_PENDING } from "@renderer/lib/constants"
import { ROUTE_ENTRY_PENDING, ROUTE_FEED_PENDING } from "@renderer/lib/constants"
import type { FeedViewType } from "@renderer/lib/enum"
import { isUndefined } from "lodash-es"
import { useCallback } from "react"
Expand Down Expand Up @@ -39,7 +39,7 @@ export const useNavigateEntry = () => useCallback((options: NavigateEntryOptions

return getStableRouterNavigate()?.(
`/feeds/${finalFeedId}/${
entryId || ROUTE_FEED_PENDING
entryId || ROUTE_ENTRY_PENDING
}?${nextSearchParams.toString()}`,
)
}, [])
1 change: 1 addition & 0 deletions src/renderer/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ export const QUERY_PERSIST_KEY = getStorageNS("REACT_QUERY_OFFLINE_CACHE")

/// Route Keys
export const ROUTE_FEED_PENDING = "all"
export const ROUTE_ENTRY_PENDING = "pending"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRouteView } from "@renderer/hooks/biz/useRouteParams"
import { ROUTE_FEED_PENDING, views } from "@renderer/lib/constants"
import { ROUTE_ENTRY_PENDING, views } from "@renderer/lib/constants"
import { EntryContent } from "@renderer/modules/entry-content"
import { AnimatePresence } from "framer-motion"
import { useParams } from "react-router-dom"
Expand All @@ -12,7 +12,7 @@ export const Component = () => {
<AnimatePresence>
{!inWideMode && (
<div className="min-w-0 flex-1">
<EntryContent entryId={entryId === ROUTE_FEED_PENDING ? "" : entryId} />
<EntryContent entryId={entryId === ROUTE_ENTRY_PENDING ? "" : entryId} />
</div>
)}
</AnimatePresence>
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/pages/(main)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { levels, ROUTE_FEED_PENDING } from "@renderer/lib/constants"
import { levels, ROUTE_ENTRY_PENDING, ROUTE_FEED_PENDING } from "@renderer/lib/constants"
import { FeedViewType } from "@renderer/lib/enum"
import { redirect } from "react-router-dom"

Expand All @@ -8,4 +8,4 @@ export function Component() {

export const loader = () =>
// navigate to the first feed
redirect(`/feeds/${ROUTE_FEED_PENDING}?view=${FeedViewType.Articles}&level=${levels.view}`)
redirect(`/feeds/${ROUTE_FEED_PENDING}/${ROUTE_ENTRY_PENDING}?view=${FeedViewType.Articles}&level=${levels.view}`)

0 comments on commit dff5a87

Please sign in to comment.