* Fixed pathname check in router
Remove the query portion of the URL when checking paths
* Updated change and added trial test
* Update test
Co-authored-by: JJ Kasper <jj@jjsweb.site>
* Remove ts-ignore where possible
And replace by typecasts
* More accurate types
* bend cliententries in a correct shape earlier on
* comment becomes unnecessary
* add webpack overload to allow for the next.js use case
* Avoid changing public interface
Co-authored-by: Joe Haddad <timer150@gmail.com>
This adds a `isFallback` property to detect if the page is being rendered in "fallback" mode or normal mode.
Accessed via the `useRouter()` hook.
---
Closes#10527
* Adjust SSG Loading Behavior
* Update expected preview behavior
* Rename two corrections
* Only use skeleton in production for now
* Fix "should SSR SPR page correctly" test
* fix tests
* fix trailing comment letter
* disable test for now
* Add initial SSG fallback handling
* Remove extra changes and update fallback handling
* Remove extra timeout for testing
* Update SSG tests in dynamic-routing suite
* Add racing to decide between rendering fallback and data
* Update size-limit test
* Update comment
* Make sure to follow correct route change order
* Make comment more verbose for racing
* Revert getStaticData to only return Promise
* Make sure to update URL on fallback
* Add retrying for data, de-dupe initial fallback request, and merge fallback replace
* Update to add preload for fallback pages data
* Add test for data preload link
* Use pre-built fallback in production mode
* Remove preload link for fallback from _document
* Update to make sure fallback is rendered correctly for serverless
* Add support for unstable_getServerProps
* Apply suggestions from review
* Add no-cache header and update types
* Revert sharing of load-components type
* Add catchall test and update routes-manifest field
* Update header check
* Update to pass query for getServerProps data requests
* Update to not cache getServerProps requests
* Rename server side props identifier
* Update to nest props for getServerProps
* Add no-cache header in serverless-loader also
* Update to throw error for mixed SSG/serverProps earlier
* Add comment explaining params chosing in serverless-loader
* Update invalidKeysMsg to return a string and inline throwing
* Inline throwing mixed SSG/serverProps error
* Update setting cache header in serverless-loader
* Add separate getServerData method in router
* Update checkIsSSG -> isDataIdentifier
* Refactor router getData back to ternary
* Apply suggestions to build/index.ts
* drop return
* De-dupe extra escape regex
* Add param test
* Allow mismatch href and as when manually provided
* Swap warning and error and throw error in production also
* Add test for mismatch error in production
* Update to only show warning in development
* added option to changeState when onlyAHashChange
* added integration tests
* segregated tests because they caused other tests to fail
Co-authored-by: JJ Kasper <jj@jjsweb.site>
* Use smaller name as it's not shortened
* Remove export as it's not used and it'll be shortened
* Update size
Co-authored-by: Joe Haddad <timer150@gmail.com>
* Use Cached SSG Data on History Navigation
* Add data caching test
* Create a static data cache
* Eliminate an if / return
* Do not cache in dev mode
* bump
* bump
* bump
* bump
Co-authored-by: JJ Kasper <jj@jjsweb.site>
This PR refactors `Router#getInitialProps` in preparation for dedicated SSG fetching logic. This PR should have no functional change -- please review it carefully.
* Add buildId to SPR data routes
* Update buildId replace in serverless loader
* Use new RegExp and add comment
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>
* Test to ensure client transition and handle / data route
* initial commit for SPRv2
* Add initial SPR cache handling
* update SPR handling
* Implement SPR handling in render
* Update tests, handle caching with serverless next
start, add TODOs, and update manifest generating
* Handle no prerender-manifest from not being used
* Fix url.parse error
* Apply suggestions from code review
Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>
* Replace set with constants in next-page-config
* simplify sprStatus.used
* Add error if getStaticProps is used with getInitialProps
* Remove stale TODO
* Update revalidate values in SPR cache for non-seeded routes
* Apply suggestions from code review
* Remove concurrency type
* Rename variable for clarity
* Add copying prerender files during export
* Add comment for clarity
* Fix exporting
* Update comment
* Add additional note
* Rename variable
* Update to not re-export SPR pages from build
* Hard navigate when fetching data fails
* Remove default extension
* Add brackets
* Add checking output files to prerender tests
* Adjust export move logic
* Clarify behavior of export aggregation
* Update variable names for clarity
* Update tests
* Add comment
* s/an oxymoron/contradictory/
* rename
* Extract error case
* Add tests for exporting SPR pages and update
/_next/data endpoint to end with .json
* Relocate variable
* Adjust route building
* Rename to unstable
* Rename unstable_getStaticParams
* Fix linting
* Only add this when a data request
* Update prerender data tests
* s/isServerless/isLikeServerless/
* Don't rely on query for `next start` in serverless mode
* Rename var
* Update renderedDuringBuild check
* Add test for dynamic param with bracket
* Fix serverless next start handling
* remove todo
* Adjust comment
* Update calculateRevalidate
* Remove cache logic from render.tsx
* Remove extra imports
* Move SPR cache logic to next-server
* Remove old isDynamic prop
* Add calling App getInitialProps for SPR pages
* Update revalidate logic
* Add isStale to SprCacheValue
* Update headers for SPR
* add awaiting pendingRevalidation
* Dont return null for revalidation render
* Adjust logic
* Be sure to remove coalesced render
* Fix data for serverless
* Create a method coalescing utility
* Remove TODO
* Extract send payload helper
* Wrap in-line
* Move around some code
* Add tests for de-duping and revalidating
* Update prerender manifest test