Skip to content
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

"Not-found.tsx" file not working in "src/app/(app)" folder #6511

Closed
dmvdven opened this issue May 26, 2024 · 3 comments
Closed

"Not-found.tsx" file not working in "src/app/(app)" folder #6511

dmvdven opened this issue May 26, 2024 · 3 comments
Assignees
Labels

Comments

@dmvdven
Copy link

dmvdven commented May 26, 2024

Link to reproduction

No response

Payload Version

3.0.0-beta.32

Node Version

20.13.1

Next.js Version

14.3.0-canary.37

Describe the Bug

Hi,

I tried adding a "not-found.tsx" file inside my "src/app/(app)" folder, but this doesn't seem to work. It still shows me the default 404 NextJS page.

Am I missing something or putting the file in the wrong directory?

Scherm­afbeelding 2024-05-26 om 12 05 32

Reproduction Steps

Put a "not-found.tsx" file in the "src/app/(app)" folder.

Adapters and Plugins

No response

@dmvdven dmvdven added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels May 26, 2024
@domenico-ruggiano
Copy link

this is a problem related to next.js multi layout: vercel/next.js#50034

@jacobsfletch
Copy link
Member

Hey @dmvdven I went ahead and tested this just now and @domenico-ruggiano is right in that this is a Next.js issue. There is, however, a workaround posted in that discussion which worked for me as a temporary solution.

From victorandree:

You can add a dynamic catch-all route to catch all and in this route you can call notFound. This triggers the closest not-found.tsx.

app
├── (app1)
│   ├── [...not-found]
│   │   └── page.tsx
│   ├── layout.tsx
│   ├── not-found.tsx
│   └── page.tsx
└── (app2)
   ├── admin
   │   └── page.tsx
   └── layout.tsx

In (app1)/[...not-found]/page.tsx:

import { notFound } from 'next/navigation';

export default function NotFoundDummy() {
 notFound();
}

@jacobsfletch jacobsfletch closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jul 29, 2024
Copy link

github-actions bot commented Sep 6, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants