-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Optimize dynamicParams generation in character page
This commit refactors the dynamicParams generation in the character page to improve performance. Instead of sorting the characters array after retrieving them from the API, the sorting is now done directly in the API call by adding the "sort" parameter. This reduces the amount of data transferred and improves the overall efficiency of the page.
- Loading branch information
Showing
3 changed files
with
49 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
|
||
type Props = { | ||
elementId: string; | ||
children: React.ReactNode; | ||
} & React.HTMLAttributes<HTMLDivElement>; | ||
|
||
export default function GoTo({ elementId, children, ...props }: Props) { | ||
const router = useRouter(); | ||
|
||
const handleNavigation = (url: string) => { | ||
router.push(url); | ||
}; | ||
|
||
return ( | ||
<div role="button" onClick={() => handleNavigation(elementId)} {...props}> | ||
{children} | ||
</div> | ||
); | ||
} |