@kentcdodds/react-workshop-app version: 2.19.2
node version: 14.12.0
npm version: 6.14.8
What you did:
Navigated to a spurious route, e.g. /abcdef or an exercise that didn't exist, e.g. /99
What happened:

When instead the NotFound component should have been rendered.
Reproduction repository:
You can reproduce this on any downloaded course section
Problem description:
The NotFound component is not rendered when an invalid URL is navigated to.
This is happening because:
- The
/:exerciseNumber route is not scoped to just capture numbers, but any url. Therefore no url ever reaches the NotFound catch all route.
- The
ExerciseContainer component does not check the bounds of exerciseInfo, so if the exerciseNumber passed in is invalid (either a string or a number outside of the defined exercises) the app crashes with a destructuring error as shown above.
Suggested solution:
- Scope the
/:exerciseNumber/ route to only accept numbers, via regex. This should fix 404 handling for non number parameters.
- Add a bounds check and render NotFound in ExerciseContainer if the number passed is not found in
exerciseInfo.
I'd be happy to submit a PR for the changes if desired.
@kentcdodds/react-workshop-appversion: 2.19.2nodeversion: 14.12.0npmversion: 6.14.8What you did:
Navigated to a spurious route, e.g.
/abcdefor an exercise that didn't exist, e.g./99What happened:
When instead the NotFound component should have been rendered.
Reproduction repository:
You can reproduce this on any downloaded course section
Problem description:
The NotFound component is not rendered when an invalid URL is navigated to.
This is happening because:
/:exerciseNumberroute is not scoped to just capture numbers, but any url. Therefore no url ever reaches the NotFound catch all route.ExerciseContainercomponent does not check the bounds ofexerciseInfo, so if the exerciseNumber passed in is invalid (either a string or a number outside of the defined exercises) the app crashes with a destructuring error as shown above.Suggested solution:
/:exerciseNumber/route to only accept numbers, via regex. This should fix 404 handling for non number parameters.exerciseInfo.I'd be happy to submit a PR for the changes if desired.