-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Feat: show 404 when getStaticPaths
doesn't match URL
#2743
Conversation
🦋 Changeset detectedLatest commit: 951ec46 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good at first glance. I'd double check to make sure that the changes to eagerly calling getParamsAndProps
and passing the result into ssr
don't break anything in build. Those might be shared across dev and build?
Thankfully not! |
ea1fcf2
to
07dd78e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM! Pleased with the direction you took this. 👍🏻
Left a few small comments that might tighten things up a bit.
packages/astro/test/fixtures/astro-get-static-paths/src/pages/pizza/[...pizza].astro
Show resolved
Hide resolved
935e993
to
de126df
Compare
This reverts commit 9c395a2.
ab568fb
to
d6cdb5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job, this ended up being very clean!
A few small changes but overall approved.
Co-authored-by: Nate Moore <[email protected]>
Co-authored-by: Nate Moore <[email protected]>
Since this is the same CI failure that everything is hitting, I'm fine merging this! Go for it. |
* WIP: return 404 for unmatched getStaticPaths route * feat: regex on static paths to 404 in dev * Revert "WIP: return 404 for unmatched getStaticPaths route" This reverts commit 9c395a2. * feat: call getParamsAndProps pre-ssr to catch errs * fix: remove unused cache regex check * fix: revert getPattern changes * fix: remove unused preload props * fix: log 404 for custom 404 pages * refactor: rename fixture for clarity * feat: add getStaticPaths status code tests * fix: pas rootRelativeUrl to handle subpaths * fix: update dev-routing tests from 500 -> 404 * refactor: make error handling more explicit * lint: use typescript no shadow to fix enum issue * chore: add changeset * refactor: clarify test names * refactor: remove variable reassignment * fix: update dev-routing tests 500 > 404 * refactor: update test file structure * Fix: revert to old logging Co-authored-by: Nate Moore <[email protected]> * Chore: use `const enum` instead Co-authored-by: Nate Moore <[email protected]> * chore: format Co-authored-by: Nate Moore <[email protected]> Co-authored-by: Nate Moore <[email protected]>
Resolves #2226
Changes
getPropsAndParams
call from the Vite middlewaregetStaticPaths
errors from the browser into the consolepreload
call into Vite middleware in order to make eagergetPropsAndParams
callno-shadow
option. This is because of random linter issues on enums. See this threadTesting
packages/astro/test/astro-get-static-paths.test.js - assert status codes for valid and invalid static path matches
Docs
N/A