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 |
||
---|---|---|
.. | ||
cssnano-simple | ||
eslint-plugin-next | ||
esm-interpolate | ||
fixtures | ||
image-optimizer | ||
incremental-cache | ||
isolated | ||
next-image-loader | ||
web-runtime | ||
accept-headers.test.ts | ||
babel-plugin-next-page-config.test.ts | ||
babel-plugin-next-ssg-transform.test.ts | ||
create-client-router-filter.test.ts | ||
example.txt | ||
find-config.test.ts | ||
find-page-file.test.ts | ||
get-files-in-dir.test.ts | ||
get-page-static-infos.test.ts | ||
get-project-dir.test.ts | ||
getDisplayName.test.ts | ||
htmlescape.test.ts | ||
infer-get-server-side-props-type.test.ts | ||
infer-get-static-props.test.ts | ||
is-equal-node.unit.test.ts | ||
is-serializable-props.test.ts | ||
jest-next-swc.test.ts | ||
link-rendering.test.ts | ||
link-warnings.test.tsx | ||
loadGetInitialProps.test.ts | ||
mitt.test.ts | ||
next-babel-loader-dev.test.ts | ||
next-babel-loader-prod.test.ts | ||
next-babel.test.ts | ||
next-dynamic.test.tsx | ||
next-head-rendering.test.ts | ||
next-image-get-img-props.test.ts | ||
next-image-legacy.test.ts | ||
next-image-new.test.ts | ||
next-server-utils.test.ts | ||
next-swc.test.ts | ||
oxford-comma.test.ts | ||
page-route-sorter.test.ts | ||
parse-page-static-info.test.ts | ||
parse-relative-url.test.ts | ||
phaseConstants.test.ts | ||
preserve-process-env.test.ts | ||
recursive-copy.test.ts | ||
recursive-delete.test.ts | ||
recursive-readdir.test.ts | ||
router-add-base-path.test.ts | ||
split-cookies-string.test.ts | ||
warn-removed-experimental-config.test.ts | ||
webpack-config-overrides.test.ts | ||
write-app-declarations.test.ts |