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

Custom render page function & with-next-layouts example #2

Closed
wants to merge 61 commits into from

Conversation

tz5514
Copy link
Owner

@tz5514 tz5514 commented Dec 19, 2017

No description provided.

@tz5514 tz5514 changed the title Custom render page function Custom render page function & applyLayout Dec 19, 2017
@tz5514 tz5514 changed the title Custom render page function & applyLayout Custom render page function & persistent-layouts example Dec 19, 2017
Copy link

@jdeal jdeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tz5514 Thanks for trying this approach!

I have some minor naming suggestions. More importantly, I tend to think the raw props should be passed to renderPage.

lib/app.js Outdated
@@ -72,9 +72,14 @@ class Container extends Component {

render () {
const { Component, props, url } = this.props
const component = (typeof Component.renderPage === 'function') ? (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick, could we name this page instead of component?

lib/app.js Outdated
@@ -72,9 +72,14 @@ class Container extends Component {

render () {
const { Component, props, url } = this.props
const component = (typeof Component.renderPage === 'function') ? (
Component.renderPage({ Component, props, url })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this just:

Component.renderPage(this.props)

In other word, why do most of this.props get packed into props? It seems like to me that renderPage should get the same props as Component gets + the Component itself, which is just the original this.props.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

200% agree! 🔥🔥🔥

@@ -0,0 +1,81 @@
import React from 'react'
const defualtOptions = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops 😮

@tz5514
Copy link
Owner Author

tz5514 commented Dec 20, 2017

@jdeal fixed them all. thanks for suggestions 😄 !

@tz5514 tz5514 changed the title Custom render page function & persistent-layouts example Custom render page function & with-next-layouts example Dec 20, 2017
@frol
Copy link

frol commented Jan 5, 2018

@tz5514 Let's PR it to the upstream, so this get's reviewed by the core team.

@tz5514
Copy link
Owner Author

tz5514 commented Jan 5, 2018

@frol got it!

@tz5514 tz5514 force-pushed the custom-render-page-function branch from 713d81b to 53db6d5 Compare January 5, 2018 18:50
@frol
Copy link

frol commented Jan 9, 2018

@tz5514 Do you need help with anything?

@tz5514
Copy link
Owner Author

tz5514 commented Jan 9, 2018

@frol I'm writing for new PR right now ha ha.
BTW, should I close the old PR (vercel#3471)?

@frol
Copy link

frol commented Jan 9, 2018

Yeah, I would close both vercel#3461 and vercel#3471 and reference the new PR from there.

@tz5514
Copy link
Owner Author

tz5514 commented Jan 9, 2018

@frol The new PR is here. vercel#3552
Could you help me to check this out? thanks!

@tz5514 tz5514 force-pushed the custom-render-page-function branch from 53db6d5 to 8649e43 Compare January 12, 2018 15:25
@frol
Copy link

frol commented Mar 22, 2018

@tz5514 Oh my, please, do rebase next time instead of merge.

@tz5514
Copy link
Owner Author

tz5514 commented Mar 22, 2018

@frol oops, my bad

timneutkens and others added 28 commits March 31, 2018 00:00
* Remove deprected use of apollo-client-preset, and refactor

Changes
* Remove deprected use of apollo-client-preset in favor of apollo-boost
* Refactor for usage of react-apollo@2.1

* Use standard

Just ran standard --fix
* New example: with-now-env

* updated the example with-now-env
* Fix vercel#3900 return 404 on asset hash mismatch in prod

* Make INVALID_BUILD_ID return 404
* Fix serve command

From the Firebase docs, you must use --only in order to run the local function emulator.
See https://firebase.google.com/docs/functions/local-emulator

* Add production env for firebase serve

Doesn't work without this

* Update text as suggested by @jthegedus
Makes sure highlight.js/styles/dark.css doesn’t get caught by externals.
…cel#3956)

* Add router method to inject code before popstate events

* Default _beforePopState, return true

* Fix link in README

* Re-order `if` statements per feedback
* Allow BUILD_ID to be set in the environment

This makes multi server deploys with Capistrano possible.

* next.config.js generateBuildId support

enable customising the build id via config

* Provide default for generateBuildId

* This is not used
Upgrade Babel 6 to Babel 7 (major)
)

* Examples: clarify language around Yarn create & npx

* add missing READMEs and create-next-app usage

* suggest people tag jthegedus in firebase related issues

* add yarn alt instructions

* cerebraljs example readme & fixes
* Add support for exportPathMap in development

* Add comment about what it does
@tz5514 tz5514 force-pushed the custom-render-page-function branch from 3d6601f to 4cc09fe Compare April 5, 2018 23:07
@tz5514 tz5514 closed this Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.