f0e4298f67
### What? This modifies the static generation store to instead store a `url` object with the `pathname` and `search` properties. This corrects the previous behaviour which used the variable `urlPathname` which had ambiguous meanings as it technically contained the search string as well, not just the pathname. In cases during the app render, this still grabs the contents of `url.pathname + url.search` (where `url.search` always has a leading `?` if it has any query parameters, [see the docs](https://developer.mozilla.org/en-US/docs/Web/API/URL/search)) so that it emulates the current behaviour. This allows more specific access though, where now additional parsing can be eliminated which had to strip the query string off of the `urlPathname` in a few places, and more worrisome, still accidentally contained the search string causing errors. ### How? This requires an upstream fix (#64088) which corrected a bug with the store access which had caused some previous test failures (accessing `store.url.pathname` was throwing as `store.url` was undefined on the wrong return, check the upstream PR for more details on that). This also changes out usage of `pagePath` with `route`, and lets it be the fallback (for debugging and error messaging). During static generation, we will provide a value for the page being rendered that's correlated to the particular file on the filesystem that the route is based on: ``` // rendering app/users/[userID]/page.tsx page: /users/[userID] pathname: /users/1, /users/2, etc ``` The `route` is used only for debugging, such as when `generateStaticParams` incorrectly calls `headers()`. This also moves the pathname from the `staticGenerationStore` into the `requestStore`, as it's tied to a given request. Closes NEXT-2965 |
||
---|---|---|
.. | ||
.stats-app | ||
development | ||
e2e | ||
examples | ||
integration | ||
lib | ||
production | ||
unit | ||
.gitignore | ||
build-turbopack-build-tests-manifest.js | ||
build-turbopack-dev-tests-manifest.js | ||
build-turbopack-tests-manifest.d.ts | ||
get-test-filter.js | ||
jest-setup-after-env.ts | ||
ppr-tests-manifest.json | ||
readme.md | ||
related-tests-manifest.json | ||
test-file.txt | ||
turbopack-build-tests-manifest.json | ||
turbopack-dev-examples-manifest.json | ||
turbopack-dev-tests-manifest.json |