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:
parent
ba71145768
commit
8cebbc6f01
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Reference in New Issue