From dff5a87d80be881576a97bf58faa5a07dfbcd568 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 2 Jul 2024 17:34:44 +0800 Subject: [PATCH] fix: empty entry params to `pending` Signed-off-by: Innei --- src/renderer/src/hooks/biz/useNavigateEntry.ts | 4 ++-- src/renderer/src/lib/constants.tsx | 1 + .../pages/(main)/(layer)/feeds/[feedId]/[entryId]/index.tsx | 4 ++-- src/renderer/src/pages/(main)/index.tsx | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/hooks/biz/useNavigateEntry.ts b/src/renderer/src/hooks/biz/useNavigateEntry.ts index 8d6431ee83..ce63e021e4 100644 --- a/src/renderer/src/hooks/biz/useNavigateEntry.ts +++ b/src/renderer/src/hooks/biz/useNavigateEntry.ts @@ -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" @@ -39,7 +39,7 @@ export const useNavigateEntry = () => useCallback((options: NavigateEntryOptions return getStableRouterNavigate()?.( `/feeds/${finalFeedId}/${ - entryId || ROUTE_FEED_PENDING + entryId || ROUTE_ENTRY_PENDING }?${nextSearchParams.toString()}`, ) }, []) diff --git a/src/renderer/src/lib/constants.tsx b/src/renderer/src/lib/constants.tsx index 540fb8a3c9..924b0cd1b1 100644 --- a/src/renderer/src/lib/constants.tsx +++ b/src/renderer/src/lib/constants.tsx @@ -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" diff --git a/src/renderer/src/pages/(main)/(layer)/feeds/[feedId]/[entryId]/index.tsx b/src/renderer/src/pages/(main)/(layer)/feeds/[feedId]/[entryId]/index.tsx index 190cba1d89..d8ce64b852 100644 --- a/src/renderer/src/pages/(main)/(layer)/feeds/[feedId]/[entryId]/index.tsx +++ b/src/renderer/src/pages/(main)/(layer)/feeds/[feedId]/[entryId]/index.tsx @@ -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" @@ -12,7 +12,7 @@ export const Component = () => { {!inWideMode && (
- +
)}
diff --git a/src/renderer/src/pages/(main)/index.tsx b/src/renderer/src/pages/(main)/index.tsx index c6d607ec7d..fd15692ff3 100644 --- a/src/renderer/src/pages/(main)/index.tsx +++ b/src/renderer/src/pages/(main)/index.tsx @@ -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" @@ -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}`)