Skip to content

Commit

Permalink
feat: improve docs around missing url parameter from store
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed May 7, 2024
1 parent 06e75d7 commit 40ff3b3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 25 deletions.
1 change: 1 addition & 0 deletions packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ export async function buildAppStaticPaths({
ComponentMod.staticGenerationAsyncStorage,
{
page,
url: undefined,
renderOpts: {
incrementalCache,
supportsDynamicHTML: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,25 @@ export interface StaticGenerationStore {

/**
* The URL of the request. This only specifies the pathname and the search
* part of the URL.
* part of the URL. This is `undefined` when generating static paths (ie, we
* do not know the current URL because we're invoking the function to generate
* the pathnames).
*/
readonly url?: {
/**
* The pathname of the requested URL.
*/
readonly pathname: string

/**
* The search part of the requested URL. If the request did not provide a
* search part, this will be undefined.
*/
readonly search?: string
}
readonly url:
| {
/**
* The pathname of the requested URL.
*/
readonly pathname: string

/**
* The search part of the requested URL. If the request did not provide a
* search part, this will be undefined.
*/
readonly search?: string
}
| undefined

readonly incrementalCache?: IncrementalCache
readonly isOnDemandRevalidate?: boolean
readonly isPrerendering?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ export type StaticGenerationContext = {

/**
* The URL of the request. This only specifies the pathname and the search
* part of the URL.
* part of the URL. This is only undefined when generating static paths (ie,
* there is no request in progress, nor do we know one).
*/
url?: {
/**
* The pathname of the requested URL.
*/
pathname: string
url:
| {
/**
* The pathname of the requested URL.
*/
pathname: string

/**
* The search part of the requested URL. If the request did not provide a
* search part, this will be an empty string.
*/
search?: string
}
/**
* The search part of the requested URL. If the request did not provide a
* search part, this will be an empty string.
*/
search?: string
}
| undefined
requestEndedState?: { ended?: boolean }
renderOpts: {
incrementalCache?: IncrementalCache
Expand Down

0 comments on commit 40ff3b3

Please sign in to comment.