refactor: enhance navigation by integrating view parameter retrieval

- Updated EntryColumnShortcutHandler to utilize getRouteParams for retrieving the view parameter during navigation.
- Ensured that the view parameter is passed correctly when navigating to the next entry, improving the consistency of navigation behavior.

These changes aim to enhance the clarity and functionality of the entry column navigation logic.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-09-12 02:02:48 +08:00
parent ba71145768
commit 8cebbc6f01
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,7 @@ import { toast } from "sonner"
import { FocusablePresets } from "~/components/common/Focusable"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteEntryId } from "~/hooks/biz/useRouteParams"
import { getRouteParams, useRouteEntryId } from "~/hooks/biz/useRouteParams"
import { COMMAND_ID } from "../command/commands/id"
import { useCommandBinding } from "../command/hooks/use-command-binding"
@ -71,9 +71,11 @@ export const EntryColumnShortcutHandler: FC<{
handleScrollTo(nextIndex)
const nextId = data![nextIndex]
const { view } = getRouteParams()
navigate({
entryId: nextId,
view,
})
})
}, [currentEntryIdRef, dataRef, handleScrollTo, navigate, when])
@ -94,8 +96,11 @@ export const EntryColumnShortcutHandler: FC<{
handleScrollTo(nextIndex)
const nextId = data![nextIndex]
const { view } = getRouteParams()
navigate({
entryId: nextId,
view,
})
})
}, [currentEntryIdRef, dataRef, handleScrollTo, navigate])