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

404 page does not reference error URL #2064

Closed
batzlerg opened this issue Oct 13, 2023 · 3 comments
Closed

404 page does not reference error URL #2064

batzlerg opened this issue Oct 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@batzlerg
Copy link
Contributor

Describe the bug
The 404 page always references "This app could not find url /404" instead of the missing page

Expected behavior

  1. user navigates to "/missing-page"
  2. user lands on a 404 page with the text "This app could not find url /missing-page"

Current behavior

  1. user navigates to "/missing-page"
  2. user lands on a 404 page with the text "This app could not find url /404"

Steps to reproduce
A step-by-step on how to reproduce the bug behavior.

  1. visit an undefined route in the app, such as https://www.vtexfaststore.com/missing-page

Possible Solution
use router.asPath instead of router.query.from, or fix/implement whatever is supposed to populate router.query.from when the page redirects to 404.tsx

Additional context
Screen Shot 2023-10-13 at 1 18 58 PM
Screen Shot 2023-10-13 at 1 24 02 PM

@batzlerg batzlerg added the bug Something isn't working label Oct 13, 2023
@emersonlaurentino
Copy link
Member

Hi @batzlerg good catch. This really needs to be adjusted.

Feel free to create a pull request with the correction.

@batzlerg
Copy link
Contributor Author

opened a PR to address: #2083

emersonlaurentino pushed a commit that referenced this issue Oct 30, 2023
## What's the purpose of this pull request?

display the correct missing URL when hitting a 404 page
#2064

## How it works?

use `asPath` which Next provides as the alias for that particular 404
response

## How to test it?

1. visit path which doesn't exist
2. see that the URL is displayed in the body of the page

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `gatsby.store` AND
`nextjs.store` with this branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->
@emersonlaurentino
Copy link
Member

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants