language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | vercel | next.js | 5bcd33fccbb771d8004a568b67e6e03b301c5764.json | Fix missing file extensions in docs (#10251) | docs/routing/dynamic-routes.md | @@ -60,7 +60,7 @@ Client-side navigations to a dynamic route can be handled with [`next/link`](/do
Dynamic routes can be extended to catch all paths by adding three dots (`...`) inside the brackets. For example:
-- `pages/post/[...slug]` matches `/post/a`, but also `post/a/b`, `post/a/b/c` and so on.
+- `pages/pos... | true |
Other | vercel | next.js | 5bcd33fccbb771d8004a568b67e6e03b301c5764.json | Fix missing file extensions in docs (#10251) | docs/routing/introduction.md | @@ -30,7 +30,7 @@ To match a dynamic segment you can use the bracket syntax. This allows you to ma
- `pages/blog/[slug].js` → `/blog/:slug` (`/blog/hello-world`)
- `pages/[username]/settings.js` → `/:username/settings` (`/foo/settings`)
-- `pages/post/[...all]` → `/post/*` (`/post/2020/id/title`)
+- `pages/post/[..... | true |
Other | vercel | next.js | 9d7ee34d2cc026512ec05241d44d7b835f65c7d8.json | Add info on storing cache in GitHub Actions (#10231)
* Add info on storing cache in GitHub Actions
* Specify yaml for code formatting
Co-Authored-By: Joe Haddad <timer150@gmail.com>
* Fix wording
Co-Authored-By: Joe Haddad <timer150@gmail.com>
Co-authored-by: Joe Haddad <timer150@gmail.com> | errors/no-cache.md | @@ -75,6 +75,17 @@ cache:
- '.next/cache/**/*' # Cache Next.js for faster application rebuilds
```
+**GitHub Actions**
+
+Using GitHub's [actions/cache](https://github.com/actions/cache), add the following step in your workflow file:
+
+```yaml
+uses: actions/cache@v1
+with:
+ path: ${{ github.workspace }}/.ne... | false |
Other | vercel | next.js | c713741f517e219f197b192d94674628b33de0b3.json | Explain Ignored PostCSS Plugin (#10240) | errors/postcss-ignored-plugin.md | @@ -0,0 +1,20 @@
+# Ignored PostCSS Plugin
+
+#### Why This Error Occurred
+
+The project's custom PostCSS configuration attempts to configure unnecessary plugins:
+
+- postcss-modules-values
+- postcss-modules-scope
+- postcss-modules-extract-imports
+- postcss-modules-local-by-default
+- postcss-modules
+
+#### Possi... | true |
Other | vercel | next.js | c713741f517e219f197b192d94674628b33de0b3.json | Explain Ignored PostCSS Plugin (#10240) | packages/next/build/webpack/config/blocks/css/plugins.ts | @@ -37,7 +37,8 @@ function isIgnoredPlugin(pluginPath: string): boolean {
`${chalk.yellow.bold('Warning')}: Please remove the ${chalk.underline(
plugin
)} plugin from your PostCSS configuration. ` +
- `This plugin is automatically configured by Next.js.`
+ `This plugin is automatically config... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/README.md | @@ -0,0 +1,55 @@
+# Apollo Server and Client Auth Example
+
+[Apollo](https://www.apollographql.com/client/) is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/apollo/client.js | @@ -0,0 +1,152 @@
+import React from 'react'
+import Head from 'next/head'
+import { ApolloProvider } from '@apollo/react-hooks'
+import { ApolloClient } from 'apollo-client'
+import { InMemoryCache } from 'apollo-cache-inmemory'
+
+let globalApolloClient = null
+
+/**
+ * Creates and provides the apolloContext
+ * to ... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/apollo/resolvers.js | @@ -0,0 +1,95 @@
+import { AuthenticationError, UserInputError } from 'apollo-server-micro'
+import cookie from 'cookie'
+import jwt from 'jsonwebtoken'
+import getConfig from 'next/config'
+import bcrypt from 'bcrypt'
+import v4 from 'uuid/v4'
+
+const JWT_SECRET = getConfig().serverRuntimeConfig.JWT_SECRET
+
+const u... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/apollo/schema.js | @@ -0,0 +1,8 @@
+import { makeExecutableSchema } from 'graphql-tools'
+import { typeDefs } from './type-defs'
+import { resolvers } from './resolvers'
+
+export const schema = makeExecutableSchema({
+ typeDefs,
+ resolvers,
+}) | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/apollo/type-defs.js | @@ -0,0 +1,38 @@
+import gql from 'graphql-tag'
+
+export const typeDefs = gql`
+ type User {
+ id: ID!
+ email: String!
+ }
+
+ input SignUpInput {
+ email: String!
+ password: String!
+ }
+
+ input SignInInput {
+ email: String!
+ password: String!
+ }
+
+ type SignUpPayload {
+ user: User... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/components/field.js | @@ -0,0 +1,21 @@
+export default function Field(props) {
+ return (
+ <div>
+ <label
+ id={[props.name, 'label'].join('-')}
+ htmlFor={[props.name, 'input'].join('-')}
+ >
+ {props.label}{' '}
+ {props.required ? <span title="Required">*</span> : undefined}
+ </label>
+ ... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/lib/form.js | @@ -0,0 +1,13 @@
+export function getErrorMessage(error) {
+ if (error.graphQLErrors) {
+ for (const graphQLError of error.graphQLErrors) {
+ if (
+ graphQLError.extensions &&
+ graphQLError.extensions.code === 'BAD_USER_INPUT'
+ ) {
+ return graphQLError.message
+ }
+ }
+ }
... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/next.config.js | @@ -0,0 +1,5 @@
+module.exports = {
+ serverRuntimeConfig: {
+ JWT_SECRET: 'changeme',
+ },
+} | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/package.json | @@ -0,0 +1,32 @@
+{
+ "name": "with-apollo",
+ "version": "2.0.0",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@apollo/react-common": "3.1.3",
+ "@apollo/react-hooks": "3.1.3",
+ "@apollo/react-ssr": "3.1.3",
+ "apollo-cache-inme... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/about.js | @@ -0,0 +1,11 @@
+import Link from 'next/link'
+
+export default () => (
+ <div>
+ This is a static page goto{' '}
+ <Link href="/">
+ <a>dynamic</a>
+ </Link>{' '}
+ page.
+ </div>
+) | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/api/graphql.js | @@ -0,0 +1,17 @@
+import { ApolloServer } from 'apollo-server-micro'
+import { schema } from '../../apollo/schema'
+
+const apolloServer = new ApolloServer({
+ schema,
+ context(ctx) {
+ return ctx
+ },
+})
+
+export const config = {
+ api: {
+ bodyParser: false,
+ },
+}
+
+export default apolloServer.create... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/index.js | @@ -0,0 +1,46 @@
+import { withApollo } from '../apollo/client'
+import gql from 'graphql-tag'
+import Link from 'next/link'
+import { useQuery } from '@apollo/react-hooks'
+import { useRouter } from 'next/router'
+
+const ViewerQuery = gql`
+ query ViewerQuery {
+ viewer {
+ id
+ email
+ }
+ }
+`
+
+... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/signin.js | @@ -0,0 +1,75 @@
+import React from 'react'
+import Link from 'next/link'
+import { withApollo } from '../apollo/client'
+import gql from 'graphql-tag'
+import { useMutation } from '@apollo/react-hooks'
+import Field from '../components/field'
+import { getErrorMessage } from '../lib/form'
+import { useRouter } from 'n... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/signout.js | @@ -0,0 +1,29 @@
+import React from 'react'
+import { useMutation } from '@apollo/react-hooks'
+
+import gql from 'graphql-tag'
+import { useRouter } from 'next/router'
+import { withApollo } from '../apollo/client'
+
+const SignOutMutation = gql`
+ mutation SignOutMutation {
+ signOut
+ }
+`
+
+function SignOut()... | true |
Other | vercel | next.js | a356d2f68cee9cfd0ab7d5e42b6e45ef8415a98a.json | Add Apollo Server and Client Auth Example (#9913)
* Add Apollo Server and Client Auth Example
* Some updates
* Updated docs
Co-authored-by: Luis Alvarez D. <luis@zeit.co> | examples/api-routes-apollo-server-and-client-auth/pages/signup.js | @@ -0,0 +1,73 @@
+import React from 'react'
+import Link from 'next/link'
+import { withApollo } from '../apollo/client'
+import gql from 'graphql-tag'
+import { useMutation } from '@apollo/react-hooks'
+import Field from '../components/field'
+import { getErrorMessage } from '../lib/form'
+import { useRouter } from 'n... | true |
Other | vercel | next.js | bc139c29b77d0abcc73217b12bde3d2582a79b87.json | Fix a typo in docs (#10239)
SSR Catching -> SSR Caching | docs/advanced-features/custom-server.md | @@ -11,7 +11,7 @@ description: Start a Next.js app programmatically using a custom server.
<li><a href="https://github.com/zeit/next.js/tree/canary/examples/custom-server-express">Express integration</a></li>
<li><a href="https://github.com/zeit/next.js/tree/canary/examples/custom-server-hapi">Hapi integratio... | false |
Other | vercel | next.js | fb47360f8dc9f5ca1e8c6ec616c8b8b213dd716d.json | Add PostCSS Configuration to Sidebar | docs/manifest.json | @@ -121,6 +121,10 @@
"title": "Customizing Babel Config",
"path": "/docs/advanced-features/customizing-babel-config.md"
},
+ {
+ "title": "Customizing PostCSS Config",
+ "path": "/docs/advanced-features/customizing-postcss-config.md"
+ ... | false |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/README.md | @@ -0,0 +1,46 @@
+# XState example
+
+This example shows how to integrate XState in Next.js. For more info about XState you can visit [here](https://xstate.js.org/).
+
+## Deploy your own
+
+Deploy the example using [ZEIT Now](https://zeit.co/now):
+
+[](https://zeit.co/ne... | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/components/Counter.js | @@ -0,0 +1,10 @@
+export default ({ counter = {} }) => (
+ <div>
+ <h1>
+ Count: <span>{counter.count}</span>
+ </h1>
+ <button onClick={() => counter.decrement()}>-1</button>
+ <button onClick={() => counter.increment()}>+1</button>
+ <button onClick={() => counter.reset()}>Reset</button>
+ </div... | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/components/Toggle.js | @@ -0,0 +1,14 @@
+import React from 'react'
+
+const Toggle = ({ onToggle, active }) => {
+ return (
+ <div>
+ <h1>
+ Toogle status: <span>{active ? 'On' : 'Off'}</span>
+ </h1>
+ <button onClick={onToggle}>Toggle</button>
+ </div>
+ )
+}
+
+export default Toggle | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/components/index.js | @@ -0,0 +1,4 @@
+import Counter from './Counter'
+import Toggle from './Toggle'
+
+export { Counter, Toggle } | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/machines/counterMachine.js | @@ -0,0 +1,20 @@
+import { Machine, assign } from 'xstate'
+
+const increment = context => context.count + 1
+const decrement = context => context.count - 1
+
+export const counterMachine = Machine({
+ initial: 'active',
+ context: {
+ count: 0,
+ },
+ states: {
+ active: {
+ on: {
+ INC: { action... | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/machines/toggleMachine.js | @@ -0,0 +1,14 @@
+import { Machine } from 'xstate'
+
+export const toggleMachine = Machine({
+ id: 'toggle',
+ initial: 'inactive',
+ states: {
+ inactive: {
+ on: { TOGGLE: 'active' },
+ },
+ active: {
+ on: { TOGGLE: 'inactive' },
+ },
+ },
+}) | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/package.json | @@ -0,0 +1,17 @@
+{
+ "name": "with-xstate",
+ "version": "1.0.0",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@xstate/react": "0.8.1",
+ "next": "latest",
+ "react": "^16.9.0",
+ "react-dom": "^16.9.0",
+ "xstate": "4.7.6"
+ ... | true |
Other | vercel | next.js | 320d98e051c005ff71d9179b00dbd7b0dd3e72a6.json | Add example with-xstate (#10234)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-xstate/pages/index.js | @@ -0,0 +1,36 @@
+import React from 'react'
+import { useMachine } from '@xstate/react'
+import { Counter, Toggle } from '../components'
+import { toggleMachine } from '../machines/toggleMachine'
+import { counterMachine } from '../machines/counterMachine'
+
+const IndexPage = ({ count }) => {
+ const [toggleCurrent, ... | true |
Other | vercel | next.js | 60e62241a8c20e22b3117096a0cbb3f9e4881b79.json | Add Bitbucket Pipelines to errors/no-cache.md (#10229)
* Update no-cache.md: add Bitbucket Pipelines
Add section on how to setup caching for Bitbucket Pipelines
* Update no-cache.md
Change wording of referencing the next cache in bitbucket pipeline | errors/no-cache.md | @@ -74,3 +74,23 @@ cache:
- 'node_modules/**/*' # Cache `node_modules` for faster `yarn` or `npm i`
- '.next/cache/**/*' # Cache Next.js for faster application rebuilds
```
+
+**Bitbucket Pipelines**
+
+Add or merge the following into your `bitbucket-pipelines.yml` at the top level (same level as `pipelines`... | false |
Other | vercel | next.js | 85571af15750e5931172a41c5f6c91add88438f5.json | Improve Link documentation (#10225)
* Improve Link documentation
* Add comments | docs/api-reference/next/link.md | @@ -74,12 +74,38 @@ const pids = ['id1', 'id2', 'id3']
}
```
-## Example with `React.forwardRef`
+## If the child is a custom component that wraps an `<a>` tag
-If the child component in `Link` is a function component, you'll need to wrap it in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactfor... | false |
Other | vercel | next.js | dc0f2678f0978c5cabc9131e16d96524022b513e.json | Remove unnecessary exportPathMap from examples (#10218)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/gh-pages/next.config.js | @@ -5,11 +5,5 @@
const debug = process.env.NODE_ENV !== 'production'
module.exports = {
- exportPathMap: function() {
- return {
- '/': { page: '/' },
- '/about': { page: '/about' },
- }
- },
assetPrefix: !debug ? '/Next-gh-page-example/' : '',
} | true |
Other | vercel | next.js | dc0f2678f0978c5cabc9131e16d96524022b513e.json | Remove unnecessary exportPathMap from examples (#10218)
Co-authored-by: Joe Haddad <timer150@gmail.com> | examples/with-dynamic-import/next.config.js | @@ -1,8 +0,0 @@
-module.exports = {
- exportPathMap: function() {
- return {
- '/': { page: '/', query: { showMore: false } },
- '/about': { page: '/about' },
- }
- },
-} | true |
Other | vercel | next.js | 6988a2e0a567bc78bd339ae4efbbb35a4311621f.json | Use builtins for React transform (#10207)
* Disable core-js on Next.js core files as it's not transforming anything important
* Move babel options to taskr plugin
* Disable transform-runtime for pages dir
* Disable correctly
* Disable corejs for core files
* Temporarily check if this fixes the error
... | packages/next/client/router.ts | @@ -138,7 +138,7 @@ export function makePublicRouterInstance(router: Router): NextRouter {
for (const property of urlPropertyFields) {
if (typeof _router[property] === 'object') {
- instance[property] = { ..._router[property] } // makes sure query is not stateful
+ instance[property] = Object.assign... | true |
Other | vercel | next.js | 6988a2e0a567bc78bd339ae4efbbb35a4311621f.json | Use builtins for React transform (#10207)
* Disable core-js on Next.js core files as it's not transforming anything important
* Move babel options to taskr plugin
* Disable transform-runtime for pages dir
* Disable correctly
* Disable corejs for core files
* Temporarily check if this fixes the error
... | packages/next/taskfile-babel.js | @@ -15,10 +15,15 @@ const babelClientOpts = {
esmodules: true,
},
loose: true,
- exclude: ['transform-typeof-symbol'],
+ // This is handled by the Next.js webpack config that will run next/babel over the same code.
+ exclude: [
+ 'transform-typeof-symbol',
+ ... | true |
Other | vercel | next.js | 6988a2e0a567bc78bd339ae4efbbb35a4311621f.json | Use builtins for React transform (#10207)
* Disable core-js on Next.js core files as it's not transforming anything important
* Move babel options to taskr plugin
* Disable transform-runtime for pages dir
* Disable correctly
* Disable corejs for core files
* Temporarily check if this fixes the error
... | test/integration/size-limit/test/index.test.js | @@ -81,7 +81,7 @@ describe('Production response size', () => {
)
// These numbers are without gzip compression!
- const delta = responseSizeKilobytes - 235
+ const delta = responseSizeKilobytes - 233
expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrE... | true |
Other | vercel | next.js | 592a2c2f009a7be164f25af5c512c844da19cde2.json | Update tsconfig for tests | test/tsconfig.json | @@ -3,7 +3,8 @@
"module": "esnext",
"target": "es6",
"allowJs": true,
- "baseUrl": "./lib"
+ "baseUrl": "./lib",
+ "noEmit": true
},
"include": ["./**/*"]
} | false |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | packages/next/client/index.js | @@ -114,6 +114,14 @@ class Container extends React.Component {
}
)
}
+
+ if (process.env.__NEXT_TEST_MODE) {
+ window.__NEXT_HYDRATED = true
+
+ if (window.__NEXT_HYDRATED_CB) {
+ window.__NEXT_HYDRATED_CB()
+ }
+ }
}
componentDidUpdate() { | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/auto-export/test/index.test.js | @@ -8,7 +8,6 @@ import {
findPort,
killApp,
launchApp,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
@@ -42,14 +41,12 @@ const runTests = () => {
it('should update asPath after mount', async () => {
const browser = await webdriver(appPort, '/zeit/cmnt-2')
-... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/chunking/test/index.test.js | @@ -3,13 +3,7 @@
import { join } from 'path'
import express from 'express'
import http from 'http'
-import {
- nextBuild,
- waitFor,
- nextServer,
- promiseCall,
- stopApp,
-} from 'next-test-utils'
+import { nextBuild, nextServer, promiseCall, stopApp } from 'next-test-utils'
import { readdir, readFile, unlin... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/config/test/client.js | @@ -8,8 +8,6 @@ export default (context, render) => {
describe('Configuration', () => {
it('should have config available on the client', async () => {
const browser = await webdriver(context.appPort, '/next-config')
- // Wait for client side to load
- await waitFor(10000)
const serverT... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/conflicting-public-file-page/test/index.test.js | @@ -7,7 +7,6 @@ import {
findPort,
killApp,
renderViaHTTP,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
@@ -25,7 +24,6 @@ describe('Errors on conflict between public file and page file', () => {
/A conflicting public file and page file was found for path/
... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/css-client-nav/test/index.test.js | @@ -5,7 +5,6 @@ import { remove } from 'fs-extra'
import {
nextBuild,
nextStart,
- waitFor,
findPort,
killApp,
renderViaHTTP,
@@ -80,9 +79,6 @@ describe('CSS Module client-side navigation in Production', () => {
let browser
try {
browser = await webdriver(appPort, '/blue')
-
- awa... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/css-modules/test/index.test.js | @@ -178,7 +178,6 @@ xdescribe('Can hot reload CSS Module without losing state', () => {
// FIXME: this is broken
it('should update CSS color without remounting <input>', async () => {
const browser = await webdriver(appPort, '/')
- await waitFor(2000) // ensure application hydrates
const desiredTex... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/css/test/index.test.js | @@ -304,7 +304,6 @@ describe('CSS Support', () => {
let browser
try {
browser = await webdriver(appPort, '/page1')
- await waitFor(2000) // ensure application hydrates
const desiredText = 'hello world'
await browser.elementById('text-input').type(desiredText)
@@ -703,7 ... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/duplicate-pages/test/index.test.js | @@ -8,7 +8,6 @@ import {
launchApp,
renderViaHTTP,
killApp,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 1
@@ -34,7 +33,6 @@ describe('Handles Duplicate Pages', () => {
onStderr: handleOutput,
})
await renderViaHTTP(appPort, '/hello')
- awa... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/dynamic-routing/test/index.test.js | @@ -304,7 +304,6 @@ function runTests(dev) {
expect(html).toMatch(/onmpost:.*pending/)
const browser = await webdriver(appPort, '/on-mount/post-1')
- await waitFor(1000)
const text = await browser.eval(`document.body.innerHTML`)
expect(text).toMatch(/onmpost:.*post-1/)
})
@@ -316,14 +315,12 ... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/empty-object-getInitialProps/test/index.test.js | @@ -49,7 +49,6 @@ describe('Empty Project', () => {
it('should show empty object warning during client transition', async () => {
const browser = await webdriver(appPort, '/static')
- await waitFor(1000)
await browser.eval(`(function() {
window.gotWarn = false
const origWarn = console.wa... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/export-dynamic-pages-serverless/test/index.test.js | @@ -9,7 +9,6 @@ import {
startCleanStaticServer,
stopApp,
renderViaHTTP,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60
@@ -41,7 +40,6 @@ describe('Export Dyanmic Pages', () => {
expect.assertions(1)
const browser = await webdriver(port, '/regression/jeff-is-coo... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/export-dynamic-pages/test/index.test.js | @@ -9,7 +9,6 @@ import {
startCleanStaticServer,
stopApp,
renderViaHTTP,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60
@@ -41,7 +40,6 @@ describe('Export Dyanmic Pages', () => {
expect.assertions(1)
const browser = await webdriver(port, '/regression/jeff-is-coo... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/export-serverless/test/browser.js | @@ -1,6 +1,6 @@
/* eslint-env jest */
import webdriver from 'next-webdriver'
-import { check, waitFor, getBrowserBodyText } from 'next-test-utils'
+import { check, getBrowserBodyText } from 'next-test-utils'
export default function(context) {
describe('Render via browser', () => {
@@ -184,7 +184,6 @@ export def... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/export/test/browser.js | @@ -1,6 +1,6 @@
/* eslint-env jest */
import webdriver from 'next-webdriver'
-import { check, waitFor, getBrowserBodyText } from 'next-test-utils'
+import { check, getBrowserBodyText } from 'next-test-utils'
export default function(context) {
describe('Render via browser', () => {
@@ -191,7 +191,6 @@ export def... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/future/test/index.test.js | @@ -8,7 +8,6 @@ import {
startApp,
stopApp,
renderViaHTTP,
- waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
@@ -34,7 +33,6 @@ describe('future.excludeDefaultMomentLocales', () => {
it('should load momentjs', async () => {
const browser = await webdriver(appPor... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/hydration/test/index.test.js | @@ -3,13 +3,7 @@
import path from 'path'
import fs from 'fs-extra'
import webdriver from 'next-webdriver'
-import {
- nextBuild,
- nextStart,
- findPort,
- waitFor,
- killApp,
-} from 'next-test-utils'
+import { nextBuild, nextStart, findPort, killApp } from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/initial-ref/test/index.test.js | @@ -7,7 +7,6 @@ import {
nextStart,
launchApp,
findPort,
- waitFor,
killApp,
} from 'next-test-utils'
@@ -19,12 +18,11 @@ let appPort
const runTest = () => {
it('Has correct initial ref values', async () => {
const browser = await webdriver(appPort, '/')
- await waitFor(2000)
expect(awa... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/invalid-href/test/index.test.js | @@ -64,7 +64,6 @@ const showsError = async (
const noError = async (pathname, click = false) => {
const browser = await webdriver(appPort, '/')
- await waitFor(2000)
await browser.eval(`(function() {
window.caughtErrors = []
window.addEventListener('error', function (error) { | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/link-ref/test/index.test.js | @@ -35,7 +35,6 @@ const noError = async pathname => {
const didPrefetch = async pathname => {
const browser = await webdriver(appPort, pathname)
- await waitFor(500)
const links = await browser.elementsByCss('link[rel=prefetch]')
let found = false
| true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/next-dynamic/test/index.test.js | @@ -7,7 +7,6 @@ import {
findPort,
launchApp,
killApp,
- waitFor,
runNextCommand,
nextServer,
startApp,
@@ -29,7 +28,6 @@ function runTests() {
it('should render dynamic server rendered values on client mount', async () => {
const browser = await webdriver(appPort, '/')
- await waitFor(5... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/next-plugins/test/index.test.js | @@ -8,7 +8,6 @@ import {
findPort,
launchApp,
killApp,
- waitFor,
nextBuild,
nextStart,
renderViaHTTP,
@@ -57,7 +56,6 @@ function runTests() {
it('should call clientInit from plugin correctly', async () => {
const browser = await webdriver(appPort, '/')
- await waitFor(250)
expect(a... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/polyfills/test/index.test.js | @@ -1,13 +1,7 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
-import {
- nextBuild,
- findPort,
- waitFor,
- nextStart,
- killApp,
-} from 'next-test-utils'
+import { nextBuild, findPort, nextStart, killApp } from 'next-test-utils'
import webdriver from 'next-webdriver'
jasmine.DE... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/preload-viewport/test/index.test.js | @@ -36,7 +36,6 @@ describe('Prefetching Links in viewport', () => {
let browser
try {
browser = await webdriver(appPort, '/')
- await waitFor(2 * 1000)
const links = await browser.elementsByCss('link[rel=prefetch]')
let found = false
@@ -124,7 +123,6 @@ describe('Prefetching Links ... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/prerender/test/index.test.js | @@ -150,9 +150,6 @@ const navigateTest = (dev = false) => {
let text = await browser.elementByCss('p').text()
expect(text).toMatch(/hello.*?world/)
- // hydration
- await waitFor(2500)
-
// go to /another
async function goFromHomeToAnother() {
await browser.eval('window.beforeAnother ... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/production/test/index.test.js | @@ -608,7 +608,6 @@ describe('Production Usage', () => {
it('should handle AMP correctly in IE', async () => {
const browser = await webdriver(appPort, '/some-amp')
- await waitFor(1000)
const text = await browser.elementByCss('p').text()
expect(text).toBe('Not AMP')
}) | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/production/test/security.js | @@ -6,10 +6,10 @@ import { renderViaHTTP, getBrowserBodyText, waitFor } from 'next-test-utils'
import { recursiveReadDir } from 'next/dist/lib/recursive-readdir'
import { homedir } from 'os'
-// Does the same evaluation checking for INJECTED for 15 seconds, triggering every 500ms
+// Does the same evaluation checki... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/integration/size-limit/test/index.test.js | @@ -81,7 +81,7 @@ describe('Production response size', () => {
)
// These numbers are without gzip compression!
- const delta = responseSizeKilobytes - 234
+ const delta = responseSizeKilobytes - 235
expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrE... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/lib/next-test-utils.js | @@ -82,7 +82,12 @@ export function runNextCommand(argv, options = {}) {
const nextBin = path.join(nextDir, 'dist/bin/next')
const cwd = options.cwd || nextDir
// Let Next.js decide the environment
- const env = { ...process.env, ...options.env, NODE_ENV: '' }
+ const env = {
+ ...process.env,
+ ...opti... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/lib/next-webdriver.d.ts | @@ -0,0 +1,28 @@
+interface Chain {
+ elementByCss: () => Chain
+ elementById: () => Chain
+ getValue: () => Chain
+ text: () => Chain
+ type: () => Chain
+ moveTo: () => Chain
+ getComputedCss: () => Chain
+ getAttribute: () => Chain
+ hasElementByCssSelector: () => Chain
+ click: () => Chain
+ elementsByCs... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/lib/next-webdriver.js | @@ -1,7 +1,9 @@
+/// <reference types="./next-webdriver" />
import os from 'os'
import path from 'path'
import fetch from 'node-fetch'
-import { until, Builder, By } from 'selenium-webdriver'
+import Chain from './wd-chain'
+import { Builder, By } from 'selenium-webdriver'
import { Options as ChromeOptions } from '... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/lib/wd-chain.js | @@ -0,0 +1,133 @@
+import { until, By } from 'selenium-webdriver'
+
+export default class Chain {
+ constructor(browser) {
+ this.browser = browser
+ }
+
+ updateChain(nextCall) {
+ if (!this.promise) {
+ this.promise = Promise.resolve()
+ }
+ this.promise = this.promise.then(nextCall)
+ this.the... | true |
Other | vercel | next.js | 53e9983d83d0bcdc1d84617d4fadf0707d9dfbb5.json | Add hydration callback for testing (#10195)
* Add hydration callback for testing
* Update size-limit test | test/tsconfig.json | @@ -0,0 +1,9 @@
+{
+ "compilerOptions": {
+ "module": "esnext",
+ "target": "es6",
+ "allowJs": true,
+ "baseUrl": "./lib"
+ },
+ "include": ["./**/*"]
+} | true |
Other | vercel | next.js | 9b512a850cff7d4ff1329c3dcfff097c5c5f4e2b.json | Stabilize New Dev Test (#10188) | test/integration/invalid-href/test/index.test.js | @@ -64,6 +64,7 @@ const showsError = async (
const noError = async (pathname, click = false) => {
const browser = await webdriver(appPort, '/')
+ await waitFor(2000)
await browser.eval(`(function() {
window.caughtErrors = []
window.addEventListener('error', function (error) {
@@ -74,7 +75,8 @@ const... | false |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | packages/next/next-server/server/config.ts | @@ -105,6 +105,35 @@ function assignDefaults(userConfig: { [key: string]: any }) {
}
}
+ if (key === 'pageExtensions') {
+ const pageExtensions = userConfig[key]
+
+ if (pageExtensions === undefined) {
+ delete userConfig[key]
+ return
+ }
+
+ if (!Array.isArray(pageEx... | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/.babelrc | @@ -1,6 +0,0 @@
-{
- "presets": [
- "next/babel",
- "@zeit/next-typescript/babel"
- ]
-}
\ No newline at end of file | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/next.config.js | @@ -1,7 +0,0 @@
-const withTypescript = require('@zeit/next-typescript')
-module.exports = withTypescript({
- onDemandEntries: {
- // Make sure entries are not getting disposed.
- maxInactiveAge: 1000 * 60 * 60,
- },
-}) | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/pages/hmr/some-page.tsx | @@ -1,23 +0,0 @@
-import React from 'react'
-
-if (typeof window !== 'undefined' && !(window as any).HMR_RANDOM_NUMBER) {
- ;(window as any).HMR_RANDOM_NUMBER = Math.random()
-}
-
-export default class Counter extends React.Component {
- state = { count: 0 }
-
- incr() {
- const { count } = this.state
- this.s... | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/pages/index.js | @@ -0,0 +1 @@
+export default () => 'Hello World' | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/test/.babelrc | @@ -1,9 +0,0 @@
-{
- "presets": [
- ["next/babel", {
- "preset-env": {
- "modules": "commonjs"
- }
- }]
- ]
-}
\ No newline at end of file | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/test/hmr.js | @@ -1,42 +0,0 @@
-/* eslint-env jest */
-import webdriver from 'next-webdriver'
-import { readFileSync, writeFileSync } from 'fs'
-import { join } from 'path'
-import { waitFor } from 'next-test-utils'
-
-export default (context, renderViaHTTP) => {
- describe('Hot Module Reloading', () => {
- it('should reload typ... | true |
Other | vercel | next.js | 39020c432d2b269c3b63d2f44d31d56fa4cfe9e1.json | Improve user errors for invalid `pageExtensions` (#10178)
* Added validation for pageExtensions and tests
* Removed log
* Test for undefined | test/integration/page-extensions/test/index.test.js | @@ -1,23 +1,81 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
-import { renderViaHTTP, findPort, launchApp, killApp } from 'next-test-utils'
+import fs from 'fs-extra'
+import { runNextCommand } from 'next-test-utils'
-// test suits
-import hmr from './hmr'
-
-const context = {}
jasmine... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | packages/next/build/utils.ts | @@ -521,7 +521,8 @@ export async function isPageStatic(
if (hasStaticProps && hasStaticPaths) {
prerenderPaths = [] as string[]
- const _routeMatcher = getRouteMatcher(getRouteRegex(page))
+ const _routeRegex = getRouteRegex(page)
+ const _routeMatcher = getRouteMatcher(_routeRegex)
... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | test/integration/prerender-invalid-catchall-params/pages/[...slug].js | @@ -0,0 +1,20 @@
+import React from 'react'
+
+// eslint-disable-next-line camelcase
+export async function unstable_getStaticPaths() {
+ return [{ params: { slug: 'hello' } }]
+}
+
+// eslint-disable-next-line camelcase
+export async function unstable_getStaticProps({ params }) {
+ return {
+ props: {
+ post... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | test/integration/prerender-invalid-catchall-params/test/index.test.js | @@ -0,0 +1,17 @@
+/* eslint-env jest */
+/* global jasmine */
+import { join } from 'path'
+import { nextBuild } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+const appDir = join(__dirname, '..')
+
+describe('Invalid Prerender Catchall Params', () => {
+ it('should fail the build', async ... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | test/integration/prerender/pages/catchall/[...slug].js | @@ -0,0 +1,19 @@
+export async function unstable_getStaticProps({ params: { slug } }) {
+ return {
+ props: {
+ slug,
+ },
+ revalidate: 1,
+ }
+}
+
+export async function unstable_getStaticPaths() {
+ return [
+ { params: { slug: ['first'] } },
+ '/catchall/second',
+ { params: { slug: ['anot... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | test/integration/prerender/pages/index.js | @@ -36,6 +36,9 @@ const Page = ({ world, time }) => {
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a>
</Link>
+ <Link href="/catchall/[...slug]" as="/catchall/first">
+ <a id="to-catchall">to catchall</a>
+ </Link>
</... | true |
Other | vercel | next.js | 5f5c5e4e9e25360d589d388da869f4ea6acd5715.json | Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG
* Add test for invalid catchall param in getStaticPaths | test/integration/prerender/test/index.test.js | @@ -108,6 +108,26 @@ const expectedManifestRoutes = () => ({
initialRevalidateSeconds: false,
srcRoute: null,
},
+ '/catchall/another%2Fvalue': {
+ dataRoute: `/_next/data/${buildId}/catchall/another%2Fvalue.json`,
+ initialRevalidateSeconds: 1,
+ srcRoute: '/catchall/[...slug]',
+ },
+ '/catch... | true |
Other | vercel | next.js | ea0d916b50fdf7faa0534446a4bf672bedb0e344.json | example: Convert _app.js to functional components (#10115)
Fix formatting | examples/with-app-layout/pages/_app.js | @@ -1,20 +1,9 @@
import React from 'react'
-import App from 'next/app'
-class Layout extends React.Component {
- render() {
- const { children } = this.props
- return <div className="layout">{children}</div>
- }
-}
+const Layout = ({ children }) => <div className="layout">{children}</div>
-export default c... | false |
Other | vercel | next.js | a21a8fcc4dd23f0772fb3732b6ff66519ac492ba.json | Add error for invalid distDir value (#10177)
* Add error for invalid distDir value
* Add check for null/undefined distDir
Co-authored-by: Joe Haddad <timer150@gmail.com> | packages/next/next-server/server/config.ts | @@ -83,10 +83,26 @@ function assignDefaults(userConfig: { [key: string]: any }) {
experimentalWarning()
}
- if (key === 'distDir' && userConfig[key] === 'public') {
- throw new Error(
- `The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://err.sh/zeit/n... | true |
Other | vercel | next.js | a21a8fcc4dd23f0772fb3732b6ff66519ac492ba.json | Add error for invalid distDir value (#10177)
* Add error for invalid distDir value
* Add check for null/undefined distDir
Co-authored-by: Joe Haddad <timer150@gmail.com> | test/integration/dist-dir/test/index.test.js | @@ -1,53 +1,65 @@
/* eslint-env jest */
/* global jasmine */
+import fs from 'fs-extra'
import { join } from 'path'
-import { existsSync } from 'fs'
import { BUILD_ID_FILE } from 'next/constants'
import {
- nextServer,
+ nextStart,
nextBuild,
- startApp,
- stopApp,
+ findPort,
+ killApp,
renderViaHTTP,... | true |
Other | vercel | next.js | e04e5a5c15bdf52dfbaef4842ffc4b6cfc9ea059.json | Add initial support for static 404 page (#10113)
* Add initial support for static 404 page
* Apply suggestions from code review
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Simplify custom error page check
* Add comment explaining reason for custom app check
Co-authored-by: Tim Neutkens <tim@timn... | packages/next/build/index.ts | @@ -197,6 +197,9 @@ export default async function build(dir: string, conf = null): Promise<void> {
const pageKeys = Object.keys(mappedPages)
const dynamicRoutes = pageKeys.filter(page => isDynamicRoute(page))
const conflictingPublicFiles: string[] = []
+ const hasCustomErrorPage = mappedPages['/_error'].start... | true |
Other | vercel | next.js | e04e5a5c15bdf52dfbaef4842ffc4b6cfc9ea059.json | Add initial support for static 404 page (#10113)
* Add initial support for static 404 page
* Apply suggestions from code review
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Simplify custom error page check
* Add comment explaining reason for custom app check
Co-authored-by: Tim Neutkens <tim@timn... | packages/next/next-server/server/config.ts | @@ -51,6 +51,7 @@ const defaultConfig: { [key: string]: any } = {
reactMode: 'legacy',
workerThreads: false,
basePath: '',
+ static404: false,
},
future: {
excludeDefaultMomentLocales: false, | true |
Other | vercel | next.js | e04e5a5c15bdf52dfbaef4842ffc4b6cfc9ea059.json | Add initial support for static 404 page (#10113)
* Add initial support for static 404 page
* Apply suggestions from code review
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Simplify custom error page check
* Add comment explaining reason for custom app check
Co-authored-by: Tim Neutkens <tim@timn... | packages/next/next-server/server/next-server.ts | @@ -1049,7 +1049,23 @@ export default class Server {
_pathname: string,
query: ParsedUrlQuery = {}
) {
- const result = await this.findPageComponents('/_error', query)
+ let result: null | LoadComponentsReturnType = null
+
+ // use static 404 page if available and is 404 response
+ if (this.nex... | true |
Other | vercel | next.js | e04e5a5c15bdf52dfbaef4842ffc4b6cfc9ea059.json | Add initial support for static 404 page (#10113)
* Add initial support for static 404 page
* Apply suggestions from code review
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Simplify custom error page check
* Add comment explaining reason for custom app check
Co-authored-by: Tim Neutkens <tim@timn... | test/integration/static-404/pages/index.js | @@ -0,0 +1 @@
+export default () => 'hi' | true |
Other | vercel | next.js | e04e5a5c15bdf52dfbaef4842ffc4b6cfc9ea059.json | Add initial support for static 404 page (#10113)
* Add initial support for static 404 page
* Apply suggestions from code review
Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
* Simplify custom error page check
* Add comment explaining reason for custom app check
Co-authored-by: Tim Neutkens <tim@timn... | test/integration/static-404/test/index.test.js | @@ -0,0 +1,105 @@
+/* eslint-env jest */
+/* global jasmine */
+import fs from 'fs-extra'
+import { join } from 'path'
+import {
+ renderViaHTTP,
+ findPort,
+ nextBuild,
+ nextStart,
+ killApp,
+} from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
+const appDir = join(__dirname, '..')
+con... | true |
Other | vercel | next.js | 71c2354ecd615986835a2d5c2ea6117b17801703.json | fix broken link in error page (#10159)
This commit updates the link for Automatic Static Optimization page in the Documentation | errors/empty-object-getInitialProps.md | @@ -10,4 +10,4 @@ Look for any page's using `getInitialProps` that return an empty object `{}`. Yo
### Useful Links
-- [Automatic Static Optimization Documentation](https://nextjs.org/docs/#automatic-static-optimization)
+- [Automatic Static Optimization Documentation](https://nextjs.org/docs/advanced-features/aut... | false |
Other | vercel | next.js | 33b22796c753a12fb764f736b47f775801eefca2.json | Add option arg to changeState when onlyAHashChange (#10003)
* 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> | packages/next/next-server/lib/router/router.ts | @@ -299,7 +299,7 @@ export default class Router implements BaseRouter {
if (!options._h && this.onlyAHashChange(as)) {
this.asPath = as
Router.events.emit('hashChangeStart', as)
- this.changeState(method, url, addBasePath(as))
+ this.changeState(method, url, addBasePath(as), optio... | true |
Other | vercel | next.js | 33b22796c753a12fb764f736b47f775801eefca2.json | Add option arg to changeState when onlyAHashChange (#10003)
* 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> | test/integration/client-navigation/pages/nav/hash-changes-with-state.js | @@ -0,0 +1,64 @@
+import React, { Component } from 'react'
+import Router from 'next/router'
+
+let count = 0
+
+export default class SelfReload extends Component {
+ static getInitialProps({ res }) {
+ if (res) return { count: 0 }
+ count += 1
+
+ return { count }
+ }
+
+ handleAClick = () => {
+ Router... | true |
Other | vercel | next.js | 33b22796c753a12fb764f736b47f775801eefca2.json | Add option arg to changeState when onlyAHashChange (#10003)
* 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> | test/integration/client-navigation/test/index.test.js | @@ -556,19 +556,51 @@ describe('Client Navigation', () => {
await browser.close()
})
})
+ })
- describe('when hash changed to a different hash', () => {
- it('should not run getInitialProps', async () => {
- const browser = await webdriver(context.appPort, '/nav/hash-changes')
+ ... | true |
Other | vercel | next.js | 9352392f4f374e4883c24e9409bc353fc36cb9e0.json | chore(examples): Update firebase version (#10145) | examples/with-firebase-authentication/package.json | @@ -10,8 +10,8 @@
"body-parser": "^1.17.1",
"express": "^4.14.0",
"express-session": "^1.15.2",
- "firebase": "^5.6.0",
- "firebase-admin": "^5.8.2",
+ "firebase": "^7.6.2",
+ "firebase-admin": "^8.9.0",
"isomorphic-unfetch": "2.0.0",
"next": "latest",
"react": "^16.7.0", | true |
Other | vercel | next.js | 9352392f4f374e4883c24e9409bc353fc36cb9e0.json | chore(examples): Update firebase version (#10145) | examples/with-firebase-cloud-messaging/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"express": "^4.14.0",
- "firebase": "^5.5.8",
+ "firebase": "^7.6.2",
"localforage": "^1.7.3",
"next": "latest",
"react": "^16.7.0", | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.