Skip to content

Commit 0ba3763

Browse files
authored
Merge branch 'canary' into fix/error-loop
2 parents 5d55a62 + 2f03bfa commit 0ba3763

File tree

22 files changed

+117
-85
lines changed

22 files changed

+117
-85
lines changed

examples/with-loading/pages/_app.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
1-
import Router from 'next/router'
1+
import { useEffect } from 'react'
22
import Link from 'next/link'
33
import Head from 'next/head'
4+
import { useRouter } from 'next/router'
45
import NProgress from 'nprogress'
56

6-
Router.events.on('routeChangeStart', (url) => {
7-
console.log(`Loading: ${url}`)
8-
NProgress.start()
9-
})
10-
Router.events.on('routeChangeComplete', () => NProgress.done())
11-
Router.events.on('routeChangeError', () => NProgress.done())
12-
137
export default function App({ Component, pageProps }) {
8+
const router = useRouter()
9+
10+
useEffect(() => {
11+
const handleStart = (url) => {
12+
console.log(`Loading: ${url}`)
13+
NProgress.start()
14+
}
15+
const handleStop = () => {
16+
NProgress.done()
17+
}
18+
19+
router.events.on('routeChangeStart', handleStart)
20+
router.events.on('routeChangeComplete', handleStop)
21+
router.events.on('routeChangeError', handleStop)
22+
23+
return () => {
24+
router.events.off('routeChangeStart', handleStart)
25+
router.events.off('routeChangeComplete', handleStop)
26+
router.events.off('routeChangeError', handleStop)
27+
}
28+
}, [router])
29+
1430
return (
1531
<>
1632
<Head>

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
"registry": "https://registry.npmjs.org/"
1818
}
1919
},
20-
"version": "11.0.2-canary.0"
20+
"version": "11.0.2-canary.2"
2121
}

packages/create-next-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"description": "ESLint configuration used by NextJS.",
55
"main": "index.js",
66
"license": "MIT",
@@ -9,7 +9,7 @@
99
"directory": "packages/eslint-config-next"
1010
},
1111
"dependencies": {
12-
"@next/eslint-plugin-next": "11.0.2-canary.0",
12+
"@next/eslint-plugin-next": "11.0.2-canary.2",
1313
"@rushstack/eslint-patch": "^1.0.6",
1414
"@typescript-eslint/parser": "^4.20.0",
1515
"eslint-import-resolver-node": "^0.3.4",

packages/eslint-plugin-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/eslint-plugin-next",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"description": "ESLint plugin for NextJS.",
55
"main": "lib/index.js",
66
"license": "MIT",

packages/next-bundle-analyzer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/bundle-analyzer",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"main": "index.js",
55
"license": "MIT",
66
"repository": {

packages/next-codemod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/codemod",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"license": "MIT",
55
"dependencies": {
66
"chalk": "4.1.0",

packages/next-env/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/env",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"keywords": [
55
"react",
66
"next",

packages/next-mdx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/mdx",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"main": "index.js",
55
"license": "MIT",
66
"repository": {

packages/next-plugin-storybook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/plugin-storybook",
3-
"version": "11.0.2-canary.0",
3+
"version": "11.0.2-canary.2",
44
"repository": {
55
"url": "vercel/next.js",
66
"directory": "packages/next-plugin-storybook"

0 commit comments

Comments
 (0)