New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance issue between page navigation #1
Comments
From what I see, what happened is that your dynamic routes ( What commit corresponds to each version you mentioned above? Also could you paste the build log for both builds (without personal info) so I can have some idea whether it really does SSR or not? |
Vercel build logs:
All pages are Static or SSG. |
The issue can be reproduced with a dynamic route and seems to be a bug on Vercel's runtime. With commit 67414bd, while locally I will investigate further to see if I can do anything, and (hopefully) gather enough info to submit a bug report. |
For now, if search parameters are irrelevant to your application, you can remove - import { usePathname, useSearchParams } from "next/navigation";
+ import { usePathname } from "next/navigation";
function RouterEventWrapper({
onStart = () => {},
onComplete = () => {},
children,
}: React.PropsWithChildren<{ onStart?: () => void; onComplete?: () => void }>) {
const [isChanging, setIsChanging] = useState(false);
const pathname = usePathname();
- const searchParams = useSearchParams();
- useEffect(() => setIsChanging(false), [pathname, searchParams]);
+ useEffect(() => setIsChanging(false), [pathname]);
useEffect(() => {
if (isChanging) onStart();
else onComplete();
}, [isChanging]);
return (
<StartRouterChangeContext.Provider value={() => setIsChanging(true)}>
{children}
</StartRouterChangeContext.Provider>
);
} Then it would work fast on Vercel as well. (For some reasons this |
Hi. I implemented this code in my app, and I saw a massive performance hit. Navigating between pages is super slow compared to "normal" approach. Is it possible to mitigate this issue?
Without: https://adison-ro86xqv0p-adisoncavani.vercel.app/
With: https://adison-hi0d8ocz5-adisoncavani.vercel.app/
The text was updated successfully, but these errors were encountered: