Skip to content

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

Merged
vnugent merged 1 commit into
OpenBeta:developfrom
sjsikora:develop
Jul 31, 2023
Merged

fix: Implementing 404 page for unknown crags and climbs#947
vnugent merged 1 commit into
OpenBeta:developfrom
sjsikora:develop

Conversation

@sjsikora

@sjsikora sjsikora commented Jul 31, 2023

Copy link
Copy Markdown
Contributor

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

vercel Bot commented Jul 31, 2023

Copy link
Copy Markdown

@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

vercel Bot commented Jul 31, 2023

Copy link
Copy Markdown

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
@vnugent

vnugent commented Jul 31, 2023

Copy link
Copy Markdown
Contributor

@all-contributors add @sjsikora for code

@allcontributors

Copy link
Copy Markdown
Contributor

@vnugent

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

@vnugent

vnugent commented Jul 31, 2023

Copy link
Copy Markdown
Contributor

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