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

fix: Implementing 404 page for unknown crags and climbs #947

Merged
merged 1 commit into from
Jul 31, 2023
Merged

fix: Implementing 404 page for unknown crags and climbs #947

merged 1 commit into from
Jul 31, 2023

Conversation

sjsikora
Copy link
Contributor

@sjsikora sjsikora commented Jul 31, 2023


name: Pull request
about: Create a pull request
title: Implementing 404 page for unknown crags and climbs
labels: ''
assignees: ''


What type of PR is this?(check all applicable)

  • refactor
  • feature
  • bug fix
  • documentation
  • optimization
  • other

Description

Related Issues

Addressing Issue #927

What this PR achieves

As pointed out in the issue, if you go to https://openbeta.io/crag/79be0b8 or https://openbeta.io/climbs/428f9f46-7dab, you are taken to a page that looks like this:

image

This is because we are trying to query the graphqlClient with an invalid UUID. This throws an unhandled GraphQLError error in getStaticProps functions of both the crag and climbs page.

What this PR achieves is that it handles this error by returning { notFound: true } in getStaticProps, which consequently leads to the 404 page.

image

Notes

  • I ensured that this error will only trigger when there is an invalid UUID. The idea being if there were other errors, there may be a different page. I wonder if this was the right approach or if a general catch-all would work.

  • This is actually my first pull request, so I would appreciate some strict scrutiny of my code.

@vercel
Copy link

vercel bot commented Jul 31, 2023

@sjsikora is attempting to deploy a commit to the openbeta-dev Team on Vercel.

A member of the Team first needs to authorize it.

@vnugent vnugent added this to the v0.10 milestone Jul 31, 2023
@vnugent vnugent linked an issue Jul 31, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Jul 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
open-tacos ✅ Ready (Inspect) Visit Preview Jul 31, 2023 2:17am

@vnugent vnugent changed the title Implementing 404 page for unknown crags and climbs fix: Implementing 404 page for unknown crags and climbs Jul 31, 2023
@vnugent vnugent merged commit 9c79c69 into OpenBeta:develop Jul 31, 2023
3 checks passed
@vnugent
Copy link
Contributor

vnugent commented Jul 31, 2023

@all-contributors add @sjsikora for code

@allcontributors
Copy link
Contributor

@vnugent

I've put up a pull request to add @sjsikora! 🎉

@vnugent
Copy link
Contributor

vnugent commented Jul 31, 2023

Thanks for your help. A small suggestion for next time: please name your commit message per this convention https://www.conventionalcommits.org/en/v1.0.0/#summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

404 page for crags/routes that do not exist
2 participants