Skip to content

Commit

Permalink
Merge branch 'canary' into response-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
botv authored Jul 3, 2020
2 parents 76d702c + eecc737 commit b0cc648
Show file tree
Hide file tree
Showing 32 changed files with 393 additions and 241 deletions.
20 changes: 20 additions & 0 deletions docs/advanced-features/measuring-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,23 @@ export function reportWebVitals(metric) {
> ```
>
> Read more about sending results to Google Analytics [here](https://github.com/GoogleChrome/web-vitals#send-the-results-to-google-analytics).
## TypeScript
If you are using TypeScript, you can use the built-in type `NextWebVitalsMetric`:
```ts
// pages/_app.tsx
import type { AppProps, NextWebVitalsMetric } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export function reportWebVitals(metric: NextWebVitalsMetric) {
console.log(metric)
}
export default MyApp
```
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.4.5-canary.27"
"version": "9.4.5-canary.28"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "9.4.5-canary.27",
"version": "9.4.5-canary.28",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
14 changes: 13 additions & 1 deletion packages/next/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,19 @@ envConfig.setConfig({
publicRuntimeConfig: runtimeConfig || {},
})

const asPath = delBasePath(getURL())
let asPath = getURL()

// make sure not to attempt stripping basePath for 404s
if (
page !== '/404' &&
!(
page === '/_error' &&
hydrateProps &&
hydrateProps.pageProps.statusCode === '404'
)
) {
asPath = delBasePath(asPath)
}

const pageLoader = new PageLoader(buildId, prefix, page)
const register = ([r, f]) => pageLoader.registerPage(r, f)
Expand Down
Loading

0 comments on commit b0cc648

Please sign in to comment.