Skip to content

Commit

Permalink
Additional fix for Next.js pages router playground
Browse files Browse the repository at this point in the history
  • Loading branch information
apedroferreira committed Feb 14, 2025
1 parent 2521d77 commit fadcdec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions playground/nextjs-pages/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ function DefaultLayout(page: React.ReactElement<any>) {
const [orderId] = segments;

const title = React.useMemo(() => {
if (router.pathname === '/orders/new') {
if (router.asPath.split('?')[0] === '/orders/new') {
return 'New Order';
}
if (orderId && router.pathname.includes('/edit')) {
if (orderId && router.asPath.includes('/edit')) {
return `Order ${orderId} - Edit`;
}
if (orderId) {
return `Order ${orderId}`;
}
return undefined;
}, [orderId, router.pathname]);
}, [orderId, router.asPath]);

return (
<DashboardLayout>
Expand Down

0 comments on commit fadcdec

Please sign in to comment.