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

ReplaceRendererArgs interface need to include bodyComponent #28454

Closed
zce opened this issue Dec 3, 2020 · 1 comment · Fixed by #28456
Closed

ReplaceRendererArgs interface need to include bodyComponent #28454

zce opened this issue Dec 3, 2020 · 1 comment · Fixed by #28456
Assignees
Labels
topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript

Comments

@zce
Copy link

zce commented Dec 3, 2020

export interface ReplaceRendererArgs extends NodePluginArgs {
replaceBodyHTMLString: (str: string) => void
setHeadComponents: (comp: React.ReactNode[]) => void
setHtmlAttributes: (attr: ReactProps<HTMLHtmlElement>) => void
setBodyAttributes: (attr: ReactProps<HTMLBodyElement>) => void
setPreBodyComponents: (comp: React.ReactNode[]) => void
setPostBodyComponents: (comp: React.ReactNode[]) => void
setBodyProps: Function
}

Missing bodyComponent declaration in ReplaceRendererArgs interface.

Example:

/** @type {import('gatsby').GatsbySSR['replaceRenderer']} */
export const replaceRenderer = async ({
  bodyComponent, // ???
  setHeadComponents,
  replaceBodyHTMLString
}) => {
  const { ids, css, html } = extractCritical(renderToString(bodyComponent))
  setHeadComponents([
    <style
      key="emotion-styles"
      data-emotion-css={ids.join(' ')}
      dangerouslySetInnerHTML={{ __html: css }}
    />
  ])
  replaceBodyHTMLString(html)
}
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 3, 2020
@ascorbic ascorbic added topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 3, 2020
@ascorbic ascorbic self-assigned this Dec 3, 2020
@ascorbic
Copy link
Contributor

ascorbic commented Dec 3, 2020

Thanks for the report. I've opened a PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants