Switching the language the first time works well but takes increasingly more time until it freezes
Unanswered
Japanese pilchard posted this in #help-forum
Japanese pilchardOP
On subsequent changes, why? (Full code of the page: https://pastebin.com/xZ86qEbE)
"use client";
import { usePathname, useRouter } from "next/navigation";
const router = useRouter();
const pathName = usePathname();
<label htmlFor={`${menuId}-language-select`}>Language:</label>
<select
defaultValue={pathName.split("/")[1]}
onChange={(e) => {
const segments = pathName.split("/");
segments[1] = e.target.value;
const pathWithNewLocale = segments.join("/");
router.push(pathWithNewLocale);
}}
id={`${menuId}-language-select`}
className="p-3 px-5 rounded dark:bg-gray-800 border border-gray-400"
>
<option value="en">English</option>
<option value="jp">日本語</option>
</select>1 Reply
Japanese pilchardOP
Actually it was some bug with the lottie player, when I import JSON there is a memory leak. But when I put the lottie in public directory and use the URL it works fine.