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

Migrate HeadManager to use React.createContext #5945

Closed
wants to merge 4 commits into from
Closed

Migrate HeadManager to use React.createContext #5945

wants to merge 4 commits into from

Conversation

chrislloyd
Copy link
Contributor

A more focused PR from #5935 and responding to #5716. Converts HeadManager to use the new React.createContext api.

return <Container>
<Component {...pageProps} url={url} />
</Container>
return <HeadManagerContext.Provider value={headManager}>
Copy link
Member

Choose a reason for hiding this comment

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

This should be added in packages/next/client/index.js, as users override _app.js with their own render method.

@@ -2,10 +2,10 @@ import React from 'react'
import PropTypes from 'prop-types'
import sideEffect from './side-effect'

export const HeadManagerContext = React.createContext()
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be moved to a separate file so that we're 100% sure it will only bundle this line instead of always bundling the <Head> next/head component even when it's not being used.

@alexandernanberg
Copy link
Contributor

I can pick this up if you don't have time for it @chrislloyd 😄

@timneutkens
Copy link
Member

Feel free to @alexandernanberg 🙏 Thanks!

@timneutkens
Copy link
Member

Closing this PR in favor of #6038

timneutkens pushed a commit that referenced this pull request Jan 14, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants