next-international icon indicating copy to clipboard operation
next-international copied to clipboard

Custom 404 page

Open faeztgh opened this issue 1 year ago • 8 comments

Describe the bug My custom not-found.tsx page with [locale] route not working. is there any solution for it?!

To Reproduce easy to reproduce

Expected behaviour Have a custom 404 page with localization.

About (please complete the following information): "next-international": "^1.1.3", "next": "14.0.1",

faeztgh avatar Nov 14 '23 16:11 faeztgh

My custom not-found.tsx page with [locale] route not working.

Could you be more precise?

easy to reproduce

Please provide a minimal reproduction. I tried by adding a not-found.tsx file inside /app and it works fine:

Screenshot 2023-11-14 at 19 46 07

QuiiBz avatar Nov 14 '23 18:11 QuiiBz

My custom not-found.tsx page with [locale] route not working.

Could you be more precise?

easy to reproduce

Please provide a minimal reproduction. I tried adding a not-found.tsx file inside /app and it works fine:

Screenshot 2023-11-14 at 19 46 07

Sorry for not being precise enough. this is my file structure: image

when I move not-found.tsx in the app folder it says the 404 page must be near the Layout.tsx file and also can't move Layout.tsx to the app because I wanna use localization features in there and must be under [locale] route.

faeztgh avatar Nov 15 '23 17:11 faeztgh

it says the 404 page must be near the Layout.tsx file

I'm not sure to understand what you mean. What's saying that?

See this sandbox, where I'm not able to reproduce the issue: https://codesandbox.io/p/sandbox/next-international-app-router-forked-tgcmh3?file=%2Fapp%2Fnot-found.tsx%3A8%2C1&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clp14xalv000b3b6enow4bn7j%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clp14xalv00033b6eozujgqmu%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clp14xalv00083b6evkkny04c%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clp14xalv000a3b6ey1mvp5pq%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clp14xalv00033b6eozujgqmu%2522%253A%257B%2522id%2522%253A%2522clp14xalv00033b6eozujgqmu%2522%252C%2522activeTabId%2522%253A%2522clp15g4gs01j23b6ej7qsg8zd%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252F%255Blocale%255D%252Fheader.tsx%2522%252C%2522id%2522%253A%2522clp15es5600rw3b6e5272vlem%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252F%255Blocale%255D%252Flayout.tsx%2522%252C%2522id%2522%253A%2522clp15frfs01dq3b6eqyepvvok%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fapp%252Fnot-found.tsx%2522%252C%2522id%2522%253A%2522clp15g4gs01j23b6ej7qsg8zd%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%257D%252C%2522clp14xalv000a3b6ey1mvp5pq%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp14xalv00093b6ebftzqduu%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522path%2522%253A%2522%252Fen%252Fjhrazkjhr%2522%257D%255D%252C%2522id%2522%253A%2522clp14xalv000a3b6ey1mvp5pq%2522%252C%2522activeTabId%2522%253A%2522clp14xalv00093b6ebftzqduu%2522%257D%252C%2522clp14xalv00083b6evkkny04c%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clp14xalv00043b6e6satngx0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00053b6eqdr1jusu%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522build%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00063b6ec74tezsq%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%252C%257B%2522id%2522%253A%2522clp14xalv00073b6esjb29vcm%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522lint%2522%257D%255D%252C%2522id%2522%253A%2522clp14xalv00083b6evkkny04c%2522%252C%2522activeTabId%2522%253A%2522clp14xalv00043b6e6satngx0%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

QuiiBz avatar Nov 16 '23 12:11 QuiiBz

It says the 404 page must be near the Layout.tsx file

I'm not sure to understand what you mean. What's saying that?

See this sandbox, where I'm not able to reproduce the issue: Sandbox Link

image this is my folder structure right now.

image This is the error I get now.

I also matched my next and next-international version with your sandbox project but the issue is still there.

faeztgh avatar Nov 16 '23 12:11 faeztgh

Please share a minimal reproduction - as you've seen, I'm not able to reproduce the issue and I can't determine what's causing it without the code to reproduce it.

QuiiBz avatar Nov 17 '23 07:11 QuiiBz

@QuiiBz The link you provided gives me the same error OP described.

Im also encounteing this error on my project

image

GasparAdragna avatar Dec 04 '23 22:12 GasparAdragna

I added a working example of a notFound page within the [locale] folder in my repro of the issue #298 to help with this issue. You can find it here: [...notFound]/page.tsx This not found page is working even though I still have my issue with the global not-found file when built.

AvaN0x avatar Dec 08 '23 09:12 AvaN0x

Sorry for the delay, I started a new job. We're having the same issue with typehero, but this isn't a bug with next-international. The issue is with how Next.js handles 404 pages with dynamic params.

QuiiBz avatar Dec 20 '23 08:12 QuiiBz

Resolution here: https://github.com/QuiiBz/next-international/issues/357#issuecomment-1947048161

QuiiBz avatar Feb 17 '24 09:02 QuiiBz