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

feat: pathname in SSR APIs when in develop #12995

Merged
merged 2 commits into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/gatsby/cache-dir/api-ssr-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Redux, css-in-js libraries, etc. that need custom setups for server
* rendering.
* @param {Object} $0
* @param {string} $0.pathname The pathname of the page currently being rendered.
* @param {function} $0.replaceBodyHTMLString Call this with the HTML string
* you render. **WARNING** if multiple plugins implement this API it's the
* last plugin that "wins". TODO implement an automated warning against this.
Expand Down Expand Up @@ -99,6 +100,7 @@ exports.onRenderBody = true
* replace head components to be rendered in your `html.js`. This is useful if
* you need to reorder scripts or styles added by other plugins.
* @param {Object} $0
* @param {string} $0.pathname The pathname of the page currently being rendered.
* @param {Array<ReactNode>} $0.getHeadComponents Returns the current `headComponents` array.
* @param {function} $0.replaceHeadComponents Takes an array of components as its
* first argument which replace the `headComponents` array which is passed
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby/cache-dir/develop-static-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default (pagePath, callback) => {
setPreBodyComponents,
setPostBodyComponents,
setBodyProps,
pathname: pagePath,
})

apiRunner(`onPreRenderHTML`, {
Expand All @@ -93,6 +94,7 @@ export default (pagePath, callback) => {
replacePreBodyComponents,
getPostBodyComponents,
replacePostBodyComponents,
pathname: pagePath,
})

const htmlElement = React.createElement(Html, {
Expand Down