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 | 53f4f82e4c69fc9fcdd98d9c952ab0ff97665fa7.json | Catch all requests in custom server (#8704)
Some users aren't aware they need to edit their custom server to support various HTTP Methods (e.g. POST for API Routes).
Instead, we should just handle all HTTP Methods out-of-the-box.
---
Closes #8237 | examples/custom-server-polka/server.js | @@ -13,7 +13,7 @@ app.prepare().then(() => {
server.get('/b', (req, res) => app.render(req, res, '/b', req.query))
- server.get('*', (req, res) => handle(req, res))
+ server.all('*', (req, res) => handle(req, res))
server.listen(port, err => {
if (err) throw err | true |
Other | vercel | next.js | a5ebe41a9a6e63827a5aaa28b2dec3fa095eb249.json | Delay updating asPath for auto exported pages (#8681)
* Delay updating asPath for auto exported pages
* Add additional test ensuring asPath is updated | packages/next/client/index.js | @@ -163,7 +163,11 @@ export default async ({ webpackHMR: passedWebpackHMR } = {}) => {
await window.__NEXT_PRELOADREADY(dynamicIds)
}
- router = createRouter(page, query, asPath, {
+ // if auto prerendered and dynamic route wait to update asPath
+ // until after mount to prevent hydration mismatch
+ const... | true |
Other | vercel | next.js | a5ebe41a9a6e63827a5aaa28b2dec3fa095eb249.json | Delay updating asPath for auto exported pages (#8681)
* Delay updating asPath for auto exported pages
* Add additional test ensuring asPath is updated | test/integration/auto-export/test/index.test.js | @@ -66,12 +66,19 @@ describe('Auto Export', () => {
runTests()
- it('should show hydration warning from mismatching asPath', async () => {
+ it('should not show hydration warning from mismatching asPath', async () => {
const browser = await webdriver(appPort, '/zeit/cmnt-1')
await waitFor(5... | true |
Other | vercel | next.js | 79090718da0c361bb954eaa5547a2d175191fe51.json | Test non-flag and re-runs of telemetry cmds (#8697) | test/integration/telemetry/test/index.test.js | @@ -12,19 +12,51 @@ describe('Telemetry CLI', () => {
expect(stdout).toMatch(/Status: .*/)
})
- it('can enable telemetry', async () => {
+ it('can enable telemetry with flag', async () => {
const { stdout } = await runNextCommand(['telemetry', '--enable'], {
stdout: true
})
expect(stdo... | false |
Other | vercel | next.js | ba683b3fab36811926bc509341b84151485b0245.json | Support non-flag variant of telemetry cmds (#8695)
This adds support for `next telemetry disable` (and keeps support for `next telemetry --disable`).
This also informs the user telemetry was already disabled if they re-run the command to give peace of mind. | packages/next/cli/next-telemetry.ts | @@ -25,30 +25,41 @@ const nextTelemetry: cliCommand = argv => {
Allows you to control Next.js' telemetry collection
Usage
- $ next telemetry [--enable] [--disable]
+ $ next telemetry [enable/disable]
- You may pass the '--enable' or '--disable' flag to turn Next.js' telemetry coll... | false |
Other | vercel | next.js | 8444c1ffbafd26908120ae5dde4291f38aa84596.json | Update stats-config to be more deterministic (#8679) | test/.stats-app/stats-config.js | @@ -89,6 +89,7 @@ module.exports = {
path: 'next.config.js',
content: `
module.exports = {
+ generateBuildId: () => 'BUILD_ID',
webpack(config) {
config.optimization.minimize = false
config.optimization.minimizer = undefine... | false |
Other | vercel | next.js | 3052a8ff9217c18af162fcf8542b02f12203e230.json | Remove Telemetry Registration (#8664) | packages/next/telemetry/anonymous-meta.ts | @@ -0,0 +1,43 @@
+import ciEnvironment from 'ci-info'
+import isDockerFunction from 'is-docker'
+import os from 'os'
+
+type AnonymousMeta = {
+ systemPlatform: NodeJS.Platform
+ systemRelease: string
+ systemArchitecture: string
+ cpuCount: number
+ cpuModel: string | null
+ cpuSpeed: number | null
+ memoryInMb... | true |
Other | vercel | next.js | 3052a8ff9217c18af162fcf8542b02f12203e230.json | Remove Telemetry Registration (#8664) | packages/next/telemetry/anonymous-traits.ts | @@ -1,23 +0,0 @@
-import ciEnvironment from 'ci-info'
-import isDockerFunction from 'is-docker'
-import os from 'os'
-
-export function getAnonymousTraits() {
- const cpus = os.cpus() || []
-
- return {
- // Software information
- platform: os.platform(),
- release: os.release(),
- arch: os.arch(),
- /... | true |
Other | vercel | next.js | 3052a8ff9217c18af162fcf8542b02f12203e230.json | Remove Telemetry Registration (#8664) | packages/next/telemetry/storage.ts | @@ -5,8 +5,9 @@ import { BinaryLike, createHash, randomBytes } from 'crypto'
import findUp from 'find-up'
import isDockerFunction from 'is-docker'
import path from 'path'
+
+import { getAnonymousMeta } from './anonymous-meta'
import { _postPayload } from './post-payload'
-import { getAnonymousTraits } from './anony... | true |
Other | vercel | next.js | 3000d7195551d1e2b914d4a5c57ab488e228f156.json | Add intl and Apollo to packages of interest (#8665) | packages/next/telemetry/events/plugins.ts | @@ -153,6 +153,10 @@ const plugins = [
'amplify-next',
'create-next-app',
'neutron',
+ 'react-intl',
+ 'react-intl-universal',
+ '@lingui/react',
+ '@apollo/react-ssr',
]
export async function recordNextPlugins(dir: string) { | false |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 10.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 11.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 12.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 13.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 2.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 3.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 4.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 5.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 6.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 7.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 8.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy 9.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 9546f9c3ace8727e69d7348c77ce324d1638db42.json | Remove extra pages (#8651) | test/integration/handles-export-errors/pages/index copy.js | @@ -1,2 +0,0 @@
-// eslint-disable-next-line
-export default () => hello.world | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/README.md | @@ -0,0 +1,49 @@
+# Apollo Server and Client Example
+
+## How to use
+
+### Using `create-next-app`
+
+Execute [`create-next-app`](https://github.com/segmentio/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example:
+
+```bash
+n... | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/apollo/resolvers.js | @@ -0,0 +1,7 @@
+export const resolvers = {
+ Query: {
+ viewer (_parent, _args, _context, _info) {
+ return { name: 'John Smith', id: 1 }
+ }
+ }
+} | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/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 | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/apollo/type-defs.js | @@ -0,0 +1,12 @@
+import gql from 'graphql-tag'
+
+export const typeDefs = gql`
+ type User {
+ id: ID!
+ name: String!
+ }
+
+ type Query {
+ viewer: User
+ }
+` | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/lib/init-apollo.js | @@ -0,0 +1,56 @@
+import ApolloClient from 'apollo-client'
+import { SchemaLink } from 'apollo-link-schema'
+import { InMemoryCache } from 'apollo-cache-inmemory'
+import { HttpLink } from 'apollo-link-http'
+import { schema } from '../apollo/schema'
+import gql from 'graphql-tag'
+
+let apolloClient = null
+
+function... | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/lib/with-apollo-client.js | @@ -0,0 +1,62 @@
+import React from 'react'
+import initApollo from './init-apollo'
+import Head from 'next/head'
+import { getDataFromTree } from '@apollo/react-ssr'
+import { ApolloProvider } from '@apollo/react-hooks'
+
+export default App => {
+ return class Apollo extends React.Component {
+ static displayName... | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/package.json | @@ -0,0 +1,28 @@
+{
+ "name": "with-apollo",
+ "version": "2.0.0",
+ "scripts": {
+ "dev": "next",
+ "build": "next build",
+ "start": "next start"
+ },
+ "dependencies": {
+ "@apollo/react-common": "3.0.1",
+ "@apollo/react-hooks": "3.0.1",
+ "@apollo/react-ssr": "3.0.1",
+ "apollo-cache-inme... | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/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 | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/pages/api/graphql.js | @@ -0,0 +1,13 @@
+import { ApolloServer } from 'apollo-server-micro'
+import { typeDefs } from '../../apollo/type-defs'
+import { resolvers } from '../../apollo/resolvers'
+
+const apolloServer = new ApolloServer({ typeDefs, resolvers })
+
+export const config = {
+ api: {
+ bodyParser: false
+ }
+}
+
+export defa... | true |
Other | vercel | next.js | 6c01bbd6dfe1263953c7622c5104760a404df91f.json | Add Apollo Server and Client Example App (#8195)
* Add Apollo Server and Client Example
* Update Apollo Client to use previous example setup | examples/api-routes-apollo-server-and-client/pages/index.js | @@ -0,0 +1,40 @@
+import withApolloClient from '../lib/with-apollo-client'
+import gql from 'graphql-tag'
+import Link from 'next/link'
+import { useQuery } from '@apollo/react-hooks'
+
+const ViewerQuery = gql`
+ query ViewerQuery {
+ viewer {
+ id
+ name
+ status @client
+ }
+ }
+`
+
+const Ind... | true |
Other | vercel | next.js | e78324a742fb2903e7799169eb212e4d7c71fef5.json | Fix typo in README.md #8640 (#8642) | packages/next/README.md | @@ -1133,7 +1133,7 @@ export default (req, res) => {
- `res` refers to [NextApiResponse](https://github.com/zeit/next.js/blob/v9.0.0/packages/next-server/lib/utils.ts#L168-L178) which extends [http.ServerResponse](https://nodejs.org/api/http.html#http_class_http_serverresponse)
-For [API routes](#api-routes) there... | false |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | packages/next/export/index.js | @@ -1,10 +1,15 @@
import { cpus } from 'os'
-import { fork } from 'child_process'
-import { recursiveCopy } from '../lib/recursive-copy'
+import chalk from 'chalk'
+import Worker from 'jest-worker'
+import { promisify } from 'util'
import mkdirpModule from 'mkdirp'
import { resolve, join } from 'path'
+import { API_... | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | packages/next/export/worker.js | @@ -3,200 +3,187 @@ import { promisify } from 'util'
import { extname, join, dirname, sep } from 'path'
import { renderToHTML } from '../next-server/server/render'
import { writeFile, access } from 'fs'
-import { Sema } from 'async-sema'
import AmpHtmlValidator from 'amphtml-validator'
import { loadComponents } fr... | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 10.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 11.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 12.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 13.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 2.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 3.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 4.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 5.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 6.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 7.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 8.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy 9.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index copy.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/pages/index.js | @@ -0,0 +1,2 @@
+// eslint-disable-next-line
+export default () => hello.world | true |
Other | vercel | next.js | 61b8b7323e089c8cc0372ce0f32402c8d70096f8.json | Update workers for `next export` (#8623)
* Add failing test
* Add jest-worker to export | test/integration/handles-export-errors/test/index.test.js | @@ -0,0 +1,18 @@
+/* eslint-env jest */
+/* global jasmine */
+import path from 'path'
+import { nextBuild } from 'next-test-utils'
+
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
+const appDir = path.join(__dirname, '..')
+
+describe('Handles Errors During Export', () => {
+ it('Does not crash workers', async () ... | true |
Other | vercel | next.js | 56501aeb820aeee7f5077200462903ad0d12b2e9.json | Fix production test failing in ie11 (#8612) | test/integration/production/test/index.test.js | @@ -636,13 +636,12 @@ describe('Production Usage', () => {
try {
browser = await webdriver(appPort, '/mark-in-head')
- const currentPerfMarks = await browser.eval(
- `window.performance.getEntriesByType('mark')`
- )
-
- expect(currentPerfMarks).toContainEqual(
- expect.objectC... | false |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/lib/apollo.js | @@ -0,0 +1,195 @@
+import React, { useMemo } from 'react'
+import PropTypes from 'prop-types'
+import cookie from 'cookie'
+import { ApolloProvider } from '@apollo/react-hooks'
+import Head from 'next/head'
+import { ApolloClient, InMemoryCache, HttpLink } from 'apollo-boost'
+import { setContext } from 'apollo-link-co... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/lib/initApollo.js | @@ -1,64 +0,0 @@
-import { ApolloClient, InMemoryCache } from 'apollo-boost'
-import { createHttpLink } from 'apollo-link-http'
-import { setContext } from 'apollo-link-context'
-import fetch from 'isomorphic-unfetch'
-
-let apolloClient = null
-
-// Polyfill fetch() on the server (used by apollo-client)
-if (typeof wi... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/lib/withApollo.js | @@ -1,95 +0,0 @@
-import React from 'react'
-import cookie from 'cookie'
-import PropTypes from 'prop-types'
-import { getDataFromTree } from '@apollo/react-ssr'
-import Head from 'next/head'
-
-import initApollo from './initApollo'
-
-function parseCookies (req, options = {}) {
- return cookie.parse(req ? req.headers... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/pages/_app.js | @@ -1,19 +0,0 @@
-import App from 'next/app'
-import React from 'react'
-import { ApolloProvider } from '@apollo/react-hooks'
-import withApollo from '../lib/withApollo'
-
-class MyApp extends App {
- static displayName = 'MyApp'
-
- render () {
- const { Component, pageProps, apolloClient } = this.props
- retu... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/pages/create-account.js | @@ -1,35 +1,32 @@
import React from 'react'
import Link from 'next/link'
-
+import { withApollo } from '../lib/apollo'
import redirect from '../lib/redirect'
import checkLoggedIn from '../lib/checkLoggedIn'
-
import RegisterBox from '../components/RegisterBox'
-export default class CreateAccount extends React.Co... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/pages/index.js | @@ -1,11 +1,11 @@
import React from 'react'
import cookie from 'cookie'
import { useApolloClient } from '@apollo/react-hooks'
-
+import { withApollo } from '../lib/apollo'
import redirect from '../lib/redirect'
import checkLoggedIn from '../lib/checkLoggedIn'
-const Index = ({ loggedInUser }) => {
+const IndexPa... | true |
Other | vercel | next.js | cf4fdaf4f2de3062e020e62bff98ed46d3141a71.json | Remove _app.js from with-apollo-auth example (#8556)
* Move apollo logic into one file
+ Use http-link from http boost
* Remove _app.js from with-apollo-auth example
* Covert other class components to functional components
* Use esm import instead of require | examples/with-apollo-auth/pages/signin.js | @@ -1,35 +1,32 @@
import React from 'react'
import Link from 'next/link'
-
+import { withApollo } from '../lib/apollo'
import redirect from '../lib/redirect'
import checkLoggedIn from '../lib/checkLoggedIn'
-
import SigninBox from '../components/SigninBox'
-export default class Signin extends React.Component {
-... | true |
Other | vercel | next.js | 139da5ade2d6dd83e9b241b9a8e72b7546b25838.json | Prevent extraneous re-renders with next/dynamic (#11587)
* Prevent extraneous rerenders with loadables
* Don't try to spread undefined
* Allow ref to be memoized | packages/next/next-server/lib/loadable.js | @@ -164,29 +164,35 @@ function createLoadableComponent(loadFn, options) {
const context = React.useContext(LoadableContext)
const state = useSubscription(subscription)
- React.useImperativeHandle(ref, () => ({
- retry: subscription.retry,
- }))
+ React.useImperativeHandle(
+ ref,
+ (... | false |
Other | vercel | next.js | a37ad0ae077cf8892a25bb83f42a73ea51da10f0.json | Add notes to styled-components example README (#11540)
* Add notes to styled-components example README
* Adjust notes to styled-components example README | examples/with-styled-components/README.md | @@ -46,3 +46,56 @@ Deploy it to the cloud with [ZEIT Now](https://zeit.co/import?filter=next.js&utm
### Try it on CodeSandbox
[Open this example on CodeSandbox](https://codesandbox.io/s/github/zeit/next.js/tree/canary/examples/with-styled-components)
+
+### Notes
+
+When wrapping a [Link](https://nextjs.org/docs/ap... | false |
Other | vercel | next.js | f2315ffc8fc484177e5b9e4e08aeaa5f930da5a1.json | update auth0 example with getServerSideProps (#11051)
* example improved
* put user cache back
* .env.template is back
* .env.template sorting back
* Header component calls fixed
* Context API removed
* Context API related text removed from README
* put everything back but getServerSideProps
* ... | examples/auth0/pages/advanced/ssr-profile.js | @@ -1,8 +1,5 @@
-import React from 'react'
-
-// This import is only needed when checking authentication status directly from getInitialProps
+// This import is only included in the server build, because it's only used by getServerSideProps
import auth0 from '../../lib/auth0'
-import { fetchUser } from '../../lib/user... | true |
Other | vercel | next.js | f2315ffc8fc484177e5b9e4e08aeaa5f930da5a1.json | update auth0 example with getServerSideProps (#11051)
* example improved
* put user cache back
* .env.template is back
* .env.template sorting back
* Header component calls fixed
* Context API removed
* Context API related text removed from README
* put everything back but getServerSideProps
* ... | examples/auth0/pages/profile.js | @@ -11,7 +11,7 @@ function ProfileCard({ user }) {
<h1>Profile</h1>
<div>
- <h3>Profile (server rendered)</h3>
+ <h3>Profile (client rendered)</h3>
<img src={user.picture} alt="user picture" />
<p>nickname: {user.nickname}</p>
<p>name: {user.name}</p> | true |
Other | vercel | next.js | ce3f7d05b30520dfd37879b0b09f9f6109fa2367.json | Drop url dependency (#11503) | packages/next/package.json | @@ -93,7 +93,6 @@
"sass-loader": "8.0.2",
"style-loader": "1.0.0",
"styled-jsx": "3.2.5",
- "url": "0.11.0",
"use-subscription": "1.1.1",
"watchpack": "2.0.0-beta.13",
"webpack": "4.42.0", | true |
Other | vercel | next.js | ce3f7d05b30520dfd37879b0b09f9f6109fa2367.json | Drop url dependency (#11503) | yarn.lock | @@ -16652,7 +16652,7 @@ url-to-options@^1.0.1:
resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9"
integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=
-url@0.11.0, url@^0.11.0:
+url@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.... | true |
Other | vercel | next.js | b215348cdb74955ae9d3374bd511c8aff0444255.json | remove unused babel types | packages/next/types/misc.d.ts | @@ -44,80 +44,10 @@ declare module 'next/dist/compiled/babel--core' {
import m from '@babel/core'
export = m
}
-
-/*declare module 'next/dist/compiled/babel--plugin-proposal-class-properties' {
- import m from '@babel/plugin-proposal-class-properties'
- export = m
-}
-declare module 'next/dist/compiled/babel--... | false |
Other | vercel | next.js | c2c42418609d164a234629113bc4368d9840d6d3.json | Use Lax Cookie for Preview Mode (#11495)
* Use Lax Cookie for Preview Mode
* Fix tests | packages/next/next-server/server/api-utils.ts | @@ -394,15 +394,15 @@ function setPreviewData<T>(
: []),
serialize(COOKIE_NAME_PRERENDER_BYPASS, options.previewModeId, {
httpOnly: true,
- sameSite: 'strict',
+ sameSite: 'lax',
path: '/',
...(options.maxAge !== undefined
? ({ maxAge: options.maxAge } as CookieSerial... | true |
Other | vercel | next.js | c2c42418609d164a234629113bc4368d9840d6d3.json | Use Lax Cookie for Preview Mode (#11495)
* Use Lax Cookie for Preview Mode
* Fix tests | test/integration/getserversideprops-preview/test/index.test.js | @@ -74,10 +74,10 @@ function runTests(startServer = nextStart) {
.map(cookie.parse)
expect(cookies.length).toBe(2)
- expect(cookies[0]).toMatchObject({ Path: '/', SameSite: 'Strict' })
+ expect(cookies[0]).toMatchObject({ Path: '/', SameSite: 'Lax' })
expect(cookies[0]).toHaveProperty('__preren... | true |
Other | vercel | next.js | c2c42418609d164a234629113bc4368d9840d6d3.json | Use Lax Cookie for Preview Mode (#11495)
* Use Lax Cookie for Preview Mode
* Fix tests | test/integration/prerender-preview/test/index.test.js | @@ -80,10 +80,10 @@ function runTests(startServer = nextStart) {
.map(cookie.parse)
expect(cookies.length).toBe(2)
- expect(cookies[0]).toMatchObject({ Path: '/', SameSite: 'Strict' })
+ expect(cookies[0]).toMatchObject({ Path: '/', SameSite: 'Lax' })
expect(cookies[0]).toHaveProperty('__preren... | true |
Other | vercel | next.js | 44a65a5e914cae45c161a4b06bd2581051968daa.json | Update firebase to fix install errors on node 14 (#13493)
Running
```
yarn
```
in the project while on node.js 14 results into errors with the `grpc` dependency of `firebase`. Updating `firebase` fixes that. | package.json | @@ -77,7 +77,7 @@
"execa": "2.0.3",
"express": "4.17.0",
"faunadb": "2.6.1",
- "firebase": "6.3.4",
+ "firebase": "7.14.5",
"fs-extra": "9.0.0",
"get-port": "5.1.1",
"glob": "7.1.6", | true |
Other | vercel | next.js | 44a65a5e914cae45c161a4b06bd2581051968daa.json | Update firebase to fix install errors on node 14 (#13493)
Running
```
yarn
```
in the project while on node.js 14 results into errors with the `grpc` dependency of `firebase`. Updating `firebase` fixes that. | yarn.lock | @@ -1132,146 +1132,228 @@
version "0.7.5"
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed"
-"@firebase/app-types@0.4.3":
- version "0.4.3"
- resolved "https://registry.yarnpkg.com/@firebase/app-types/-/app-types-0.4.3.tgz#80d2b6e5ee43ac998... | true |
Other | vercel | next.js | 16d22358829ed1aa20d0b86a2b5cd409c1c6c542.json | Update proxy example to http-proxy-middleware ^1 (#13507)
The current example doesn't work if one try to reproduce it with a recent version of http-proxy-middleware. | examples/with-custom-reverse-proxy/package.json | @@ -10,7 +10,7 @@
},
"devDependencies": {
"cross-env": "^5.0.1",
- "http-proxy-middleware": "^0.17.4"
+ "http-proxy-middleware": "^1.0.4"
},
"scripts": {
"dev": "cross-env NODE_ENV=development PORT=3000 node server.js", | true |
Other | vercel | next.js | 16d22358829ed1aa20d0b86a2b5cd409c1c6c542.json | Update proxy example to http-proxy-middleware ^1 (#13507)
The current example doesn't work if one try to reproduce it with a recent version of http-proxy-middleware. | examples/with-custom-reverse-proxy/server.js | @@ -28,9 +28,9 @@ app
// Set up the proxy.
if (dev && devProxy) {
- const proxyMiddleware = require('http-proxy-middleware')
+ const { createProxyMiddleware } = require('http-proxy-middleware')
Object.keys(devProxy).forEach(function (context) {
- server.use(proxyMiddleware(context, d... | true |
Other | vercel | next.js | db5b5a76a8f2080161b287a067c3f1575711c589.json | Update some examples to Vercel (#13477)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | examples/with-monaco-editor/README.md | @@ -5,9 +5,9 @@ This example adds support for [Monaco Editor](https://github.com/Microsoft/monac
## Deploy your own
-Deploy the example using [ZEIT Now](https://zeit.co/now):
+Deploy the example using [Vercel](https://vercel.com):
-[](https://zeit.co/import/project?... | true |
Other | vercel | next.js | db5b5a76a8f2080161b287a067c3f1575711c589.json | Update some examples to Vercel (#13477)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | examples/with-reason-relay/README.md | @@ -6,9 +6,9 @@ This example relies on [graph.cool](https://www.graph.cool) for its GraphQL back
## Deploy your own
-Deploy the example using [ZEIT Now](https://zeit.co/now):
+Deploy the example using [Vercel](https://vercel.com):
-[](https://zeit.co/import/project?... | true |
Other | vercel | next.js | db5b5a76a8f2080161b287a067c3f1575711c589.json | Update some examples to Vercel (#13477)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | examples/with-stitches-styled/README.md | @@ -1,30 +1,21 @@
-This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
+# Stitches (Styled) Example
-## Getting Started
+This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/christi... | true |
Other | vercel | next.js | db5b5a76a8f2080161b287a067c3f1575711c589.json | Update some examples to Vercel (#13477)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> | examples/with-stitches/README.md | @@ -1,30 +1,21 @@
-This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
+# Stitches Example
-## Getting Started
+This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/christianalfoni/... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/README.md | @@ -2,7 +2,17 @@
This example shows how to integrate Redux in Next.js.
-Usually splitting your app state into `pages` feels natural but sometimes you'll want to have global state for your app. This is an example on how you can use redux that also works with Next.js's universal rendering approach.
+Usually splittin... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/components/clock.js | @@ -1,4 +1,3 @@
-import React from 'react'
import { useSelector, shallowEqual } from 'react-redux'
const useClock = () => { | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/components/counter.js | @@ -1,4 +1,3 @@
-import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
const useCounter = () => { | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/components/nav.js | @@ -0,0 +1,26 @@
+import Link from 'next/link'
+
+const Nav = () => {
+ return (
+ <nav>
+ <Link href="/">
+ <a>Index</a>
+ </Link>
+ <Link href="/ssg">
+ <a>SSG</a>
+ </Link>
+ <Link href="/ssr">
+ <a>SSR</a>
+ </Link>
+ <style jsx>
+ {`
+ a {... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/components/page.js | @@ -0,0 +1,26 @@
+import { useDispatch } from 'react-redux'
+import useInterval from '../lib/useInterval'
+import Clock from './clock'
+import Counter from './counter'
+import Nav from './nav'
+
+export default function Page() {
+ const dispatch = useDispatch()
+
+ // Tick the time every second
+ useInterval(() => {... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/lib/redux.js | @@ -1,11 +1,10 @@
-import React from 'react'
import { Provider } from 'react-redux'
import { initializeStore } from '../store'
import App from 'next/app'
-export const withRedux = (PageComponent, { ssr = true } = {}) => {
+export const withRedux = (PageComponent) => {
const WithRedux = ({ initialReduxState, ...... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/pages/_app.js | @@ -0,0 +1,12 @@
+import { Provider } from 'react-redux'
+import { useStore } from '../store'
+
+export default function App({ Component, pageProps }) {
+ const store = useStore(pageProps.initialReduxState)
+
+ return (
+ <Provider store={store}>
+ <Component {...pageProps} />
+ </Provider>
+ )
+} | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/pages/index.js | @@ -1,39 +1,5 @@
-import React from 'react'
-import { useDispatch } from 'react-redux'
-import { withRedux } from '../lib/redux'
-import useInterval from '../lib/useInterval'
-import Clock from '../components/clock'
-import Counter from '../components/counter'
+import Page from '../components/page'
-const IndexPage =... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/pages/ssg.js | @@ -0,0 +1,20 @@
+import Page from '../components/page'
+
+export default function SSG() {
+ return <Page />
+}
+
+// If you build and start the app, the date returned here will have the same
+// value for all requests, as this method gets executed at build time.
+export function getStaticProps() {
+ // Note that in ... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/pages/ssr.js | @@ -0,0 +1,22 @@
+import Page from '../components/page'
+import { initializeStore } from '../store'
+
+export default function SSR() {
+ return <Page />
+}
+
+// The date returned here will be different for every request that hits the page,
+// that is because the page becomes a serverless function instead of being st... | true |
Other | vercel | next.js | 5eafc1e92a5effa24bb6ac3c1d9e23065a16496b.json | refactor(with-redux): update example to use getStaticProps (#13378)
@lfades hope this works. I have updated the example to show differences between client/ssr/ssg initial state in redux. Let me know if something needs to be changed. | examples/with-redux/store.js | @@ -1,6 +1,9 @@
+import { useMemo } from 'react'
import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
+let store
+
const initialState = {
lastUpdate: 0,
light: false,
@@ -35,10 +38,37 @@ const reducer = (state = initialState, action) => {
}
}... | true |
Other | vercel | next.js | f0ff77ed88b78b0186231e2c7ef50f7d7903919c.json | Add note about GS(S)P imports (#13475)
As reported here:
https://twitter.com/vvoyer/status/1246913957899763712?s=21 | docs/basic-features/data-fetching.md | @@ -47,6 +47,9 @@ The `context` parameter is an object containing the following keys:
- `preview` is `true` if the page is in the preview mode and `false` otherwise. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
- `previewData` contains the preview data set by `setPreviewData`. See th... | false |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/README.md | @@ -1,8 +1,8 @@
# with-route-as-modal
-On many popular social media, opening a post will update the URL but won't trigger a navigation and will instead display the content inside a modal. This behavior ensure the user won't lose the current UI context (scroll position). The URL still reflect the post's actual page l... | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/app-styles.module.css | @@ -0,0 +1,5 @@
+.content {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+} | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/components/Article.js | @@ -0,0 +1,11 @@
+import styles from './styles.module.css'
+
+const Post = ({ id, pathname }) => {
+ return (
+ <div className={styles.post}>
+ I am the article {id}; my pathname is: {pathname}
+ </div>
+ )
+}
+
+export default Post | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/components/Grid.js | @@ -0,0 +1,28 @@
+import Link from 'next/link'
+import styles from './styles.module.css'
+
+export const data = [1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+export default function PostCardGrid() {
+ return (
+ <div className={styles.postCardGridWrapper}>
+ <h2>With QueryString Routing, and a reload won't use the modal</h2>... | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/components/Post.js | @@ -1,5 +1,11 @@
-const Post = ({ id }) => {
- return <div className="post">{`I am the post ${id}`}</div>
+import styles from './styles.module.css'
+
+const Post = ({ id, pathname }) => {
+ return (
+ <div className={styles.post}>
+ I am the post {id}; my pathname is: {pathname}
+ </div>
+ )
}
export ... | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/components/PostCard.js | @@ -1,11 +0,0 @@
-import Link from 'next/link'
-
-const PostCard = ({ id }) => {
- return (
- <Link href={`/?postId=${id}`} as={`/post/${id}`}>
- <a className="postCard">{id}</a>
- </Link>
- )
-}
-
-export default PostCard | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/components/styles.module.css | @@ -1,12 +1,6 @@
-body {
- margin: 0;
-}
-
-#__next {
+.postCardGridWrapper {
display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
+ flex-direction: column;
}
.postCardGrid { | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/pages/_app.js | @@ -1,7 +1,11 @@
-import '../style.css'
+import styles from '../app-styles.module.css'
function MyApp({ Component, pageProps }) {
- return <Component {...pageProps} />
+ return (
+ <div className={styles.content}>
+ <Component {...pageProps} />
+ </div>
+ )
}
export default MyApp | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/pages/article/[articleId].js | @@ -0,0 +1,43 @@
+import { useEffect } from 'react'
+import { useRouter } from 'next/router'
+import Modal from 'react-modal'
+import Article from '../../components/Article'
+import { data } from '../../components/Grid'
+
+Modal.setAppElement('#__next')
+
+const ArticlePage = ({ articleId }) => {
+ const router = useR... | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/pages/index.js | @@ -1,12 +1,10 @@
import { useRouter } from 'next/router'
import Modal from 'react-modal'
import Post from '../components/Post'
-import PostCard from '../components/PostCard'
+import Grid from '../components/Grid'
Modal.setAppElement('#__next')
-const posts = [1, 2, 3, 4, 5, 6, 7, 8, 9]
-
const Index = () => {... | true |
Other | vercel | next.js | 001230e0a889b17cb2ee92448ee8128d22d3cf67.json | Add Route as Modal Page Example (#12945)
### Add dynamic routes to _with-route-as-modal_ example
This PR adds [dynamic routes](https://nextjs.org/docs/routing/dynamic-routes), [getStaticPaths](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), and [getStaticProps](https://nextjs.o... | examples/with-route-as-modal/pages/post/[postId].js | @@ -5,7 +5,7 @@ const PostPage = () => {
const router = useRouter()
const { postId } = router.query
- return <Post id={postId} />
+ return <Post id={postId} pathname={router.pathname} />
}
export default PostPage | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.