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
* Remove any type and fix edge cases
Removed the "as any" and use the @babel/types typeguards instead. This revealed some edge cases that would just error.
* Remove ts-ignore
Co-authored-by: Joe Haddad <timer150@gmail.com>
* 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
* checkpoint: api impl
* Add support for tryGetPreviewData
* snapshot: server(less) support
* Add X-Prerender-Bypass-Mode header support
* Pass preview data to getStaticProps call
* add TODO
* setPreviewData
* 100k iterations
* Handle jwt error
* Write out preview values
* forgot file
* set preview props
* Send preview props
* add preview props
* Pass around more data
* update yarn lock
* Fail on Invalid Prerender Manifest
* Make Missing Prerender Manifest Fatal
* fix ts errors
* fix test
* Fix setting cookies + maxage
* Secure is not needed as we encrypt necessary data
* Set on domain root
* Set cookie max ages
* Render a fallback on-demand for non-dynamic pages
* Test preview mode
* remove old build
* remove snapshots
* Add serverless tests
* use afterAll
* Remove object assigns
* fix cookie spread
* add comment
* Update next-server routes order for expected priority
* Update router to allow disabling page routes
* Fix headers having check: true behavior when they should not
Co-authored-by: Joe Haddad <timer150@gmail.com>
* 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 rewriting to external resources
* Update rewrite proxying test
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
* Fix#8655, skip rendering meta tags with undefined props
* Filter all tags, not just meta
* Only render defined props
* Remove filtering of undefined strings
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Replace Object.entries
* Remove filtering code
* Simplify code
* Add test
* Add tests for undefined head prop value and tweak check
* Update to strip undefined prop values to match react
* Update head.js
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
* Implement experimental pages/404.js for custom 404 page
* Make sure to show error for getInitialProps in pages/404 in dev mode also
* Update routes-manifest tests for new value
* Make sure page404 is boolean in routes-manifest
* Rename variables for consistency
* Make sure to only use 404 page for 404 error
* fix: 9919 no exported config found
* fix: 9919 remove isolated test, add integration
* fix: 9919 add check for successfull compilation and fix warnin check
* Add test for development output
* fix: 9919 add error page and link to it in warning
* Update empty-configuration.md
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
* Run resolve-url-loader after sass-loader
* Add regression test
* Update test to match
* Revert global.ts
* Make `preProcessors` readonly
Co-authored-by: Joe Haddad <timer150@gmail.com>
* Update actions config for canary jobs
* Update exiting for mising value and size limit test
* Update config
* Update check
* Update check
* Remove extra check
* 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
* Add initial config
* Comment out other action
* Update config
* Update config
* Update configs
* rename requires -> needs
* Update configs
* Update configs
* Enable headless mode
* Disable circleci while testing
* Disable build-test-deploy in circle
* Update build step
* Disable fail fast
* Update configs
* Add runs-on to publish steps
* bump
* Update config
* Update group count
* Update checkout path
* Update test all concurrency
* Handle EPIPE errors
* Revert "Handle EPIPE errors"
This reverts commit a993565bbdd77df136e07d54eb83ed32b18e5963.
* Update test to handle EPIPE in test
* Remove CircleCi config
* Revert "Update test to handle EPIPE in test"
This reverts commit c8cb72d5303b5fd165016f9eba6c8c888d8a1907.
* Update to use node 10 and see if EPIPE error is still present
* Revert "Revert "Update test to handle EPIPE in test""
This reverts commit efd2abe7c35c12bf78530064796d853c171efcf1.
* Revert "Update to use node 10 and see if EPIPE error is still present"
This reverts commit 893da4f31279228ebec6fa208c34ef179a6ebaf4.
* Add todo for node issue
* undo lint change as it should be correct
* Add dummy step to require
* Add runs-on for dummy job
* Add splitting by timings for Azure
* Add --timings flag for azure
* Update timings API
* Update timings var
* Fix test directory not being reset before re-trying
* Update to re-use CircleCI timing data
* Bump concurrency for Azure
* Remove extra logging
* Update timeout for create-next-app tests
Co-authored-by: Joe Haddad <timer150@gmail.com>