Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom app example in README #8320

Merged
merged 1 commit into from
Aug 11, 2019
Merged

Conversation

borekb
Copy link
Contributor

@borekb borekb commented Aug 11, 2019

The code example now uses simpler and "safer" approach to call page's getInitialProps.

Pros:

  • Shorter code.
  • Probably more resilient / reliable as it goes through loadGetInitialProps that handles quite a few details.
  • I've seen the approach with const appProps = await App.getInitialProps(appContext) in several examples and blog posts (didn't take notes though..).

Cons:

  • It was less intuitive to me, initially, that this indeed calls page's getInitialProps.
The code example now uses simpler and safer approach to call page's `getInitialProps`.
@ijjk
Copy link
Member

ijjk commented Aug 11, 2019

Stats from current PR

Click to expand stats
zeit/next.js canary borekb/next.js patch-1 Change
Build Duration 22.7s 22.5s -251ms
node_modules Size 41.6 MB 41.6 MB -1 B
Total Bundle (main, webpack, commons) Size 214 kB 214 kB
Total Bundle (main, webpack, commons) gzip Size 70.6 kB 70.6 kB -1 B
Total Bundle (main, webpack, commons) Modern Size 189 kB 189 kB
Total Bundle (main, webpack, commons) Modern gzip Size 62.4 kB 62.4 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB -1 B
Client _app Modern Size 1.83 kB 1.83 kB
Client _app gzip Modern Size 890 B 890 B
Client _error Size 8.22 kB 8.22 kB
Client _error gzip Size 3.16 kB 3.16 kB
Client _error Modern Size 5.85 kB 5.85 kB
Client _error gzip Modern Size 2.33 kB 2.33 kB
Client pages/index Size 343 B 343 B
Client pages/index gzip Size 246 B 246 B
Client pages/index Modern Size 319 B 319 B
Client pages/index gzip Modern Size 254 B 254 B
Client pages/link Size 4.18 kB 4.18 kB
Client pages/link gzip Size 1.82 kB 1.82 kB
Client pages/link Modern Size 3.81 kB 3.81 kB
Client pages/link gzip Modern Size 1.72 kB 1.72 kB -1 B
Client pages/routerDirect Size 423 B 423 B
Client pages/routerDirect gzip Size 306 B 306 B
Client pages/routerDirect Modern Size 411 B 411 B
Client pages/routerDirect gzip Modern Size 314 B 314 B
Client pages/withRouter Size 435 B 435 B
Client pages/withRouter gzip Size 301 B 300 B -1 B
Client pages/withRouter Modern Size 423 B 423 B
Client pages/withRouter gzip Modern Size 309 B 309 B
Client main Size 16.3 kB 16.3 kB
Client main gzip Size 5.73 kB 5.73 kB
Client main Modern Size 13.1 kB 13.1 kB
Client main Modern gzip Size 4.99 kB 4.99 kB
Client commons Size 195 kB 195 kB
Client commons gzip Size 63.6 kB 63.6 kB
Client commons Modern Size 176 kB 176 kB
Client commons Modern gzip Size 57.4 kB 57.4 kB
Client webpack Size 1.53 kB 1.53 kB
Client webpack gzip Size 778 B 778 B
Client webpack Modern Size 1.53 kB 1.53 kB
Client webpack Modern gzip Size 785 B 785 B
Base Rendered Size 2.76 kB 2.76 kB
Build Dir Size 1.44 MB 1.44 MB
Click to expand serverless stats
zeit/next.js canary borekb/next.js patch-1 Change
Build Duration 25.1s 25s -44ms
node_modules Size 41.6 MB 41.6 MB -1 B
Total Bundle (main, webpack, commons) Size 214 kB 214 kB
Total Bundle (main, webpack, commons) gzip Size 70.6 kB 70.6 kB
Total Bundle (main, webpack, commons) Modern Size 189 kB 189 kB
Total Bundle (main, webpack, commons) Modern gzip Size 62.4 kB 62.4 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB
Client _app Modern Size 1.83 kB 1.83 kB
Client _app gzip Modern Size 890 B 890 B
Client _error Size 8.22 kB 8.22 kB
Client _error gzip Size 3.16 kB 3.16 kB
Client _error Modern Size 5.85 kB 5.85 kB
Client _error gzip Modern Size 2.33 kB 2.33 kB
Client pages/index Size 343 B 343 B
Client pages/index gzip Size 246 B 246 B
Client pages/index Modern Size 319 B 319 B
Client pages/index gzip Modern Size 254 B 254 B
Client pages/link Size 4.18 kB 4.18 kB
Client pages/link gzip Size 1.82 kB 1.82 kB
Client pages/link Modern Size 3.81 kB 3.81 kB
Client pages/link gzip Modern Size 1.72 kB 1.72 kB
Client pages/routerDirect Size 423 B 423 B
Client pages/routerDirect gzip Size 306 B 306 B
Client pages/routerDirect Modern Size 411 B 411 B
Client pages/routerDirect gzip Modern Size 314 B 314 B
Client pages/withRouter Size 435 B 435 B
Client pages/withRouter gzip Size 301 B 301 B
Client pages/withRouter Modern Size 423 B 423 B
Client pages/withRouter gzip Modern Size 309 B 309 B
Client main Size 16.3 kB 16.3 kB
Client main gzip Size 5.73 kB 5.73 kB
Client main Modern Size 13.1 kB 13.1 kB
Client main Modern gzip Size 4.99 kB 4.99 kB
Client commons Size 195 kB 195 kB
Client commons gzip Size 63.6 kB 63.6 kB
Client commons Modern Size 176 kB 176 kB
Client commons Modern gzip Size 57.4 kB 57.4 kB
Client webpack Size 1.53 kB 1.53 kB
Client webpack gzip Size 778 B 778 B
Client webpack Modern Size 1.53 kB 1.53 kB
Client webpack Modern gzip Size 785 B 785 B
Serverless pages/link Size 256 kB 256 kB
Serverless pages/link gzip Size 68.8 kB 68.8 kB
Serverless pages/index Size 249 kB 249 kB
Serverless pages/index gzip Size 66.6 kB 66.6 kB
Serverless pages/_error Size 248 kB 248 kB
Serverless pages/_error gzip Size 66.3 kB 66.3 kB
Serverless pages/routerDirect Size 249 kB 249 kB
Serverless pages/routerDirect gzip Size 66.5 kB 66.5 kB
Serverless pages/withRouter Size 249 kB 249 kB
Serverless pages/withRouter gzip Size 66.6 kB 66.6 kB
Build Dir Size 2.65 MB 2.65 MB
@timneutkens timneutkens merged commit 4ab56e8 into vercel:canary Aug 11, 2019
@timneutkens
Copy link
Member

Thanks!

@borekb borekb deleted the patch-1 branch August 12, 2019 07:34
@vercel vercel locked as resolved and limited conversation to collaborators Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants