-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
Conversation
return <Container> | ||
<Component {...pageProps} url={url} /> | ||
</Container> | ||
return <HeadManagerContext.Provider value={headManager}> |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
I can pick this up if you don't have time for it @chrislloyd 😄 |
Feel free to @alexandernanberg 🙏 Thanks! |
Closing this PR in favor of #6038 |
A more focused PR from #5935 and responding to #5716. Converts HeadManager to use the new React.createContext api.