Skip to content

Commit

Permalink
feat(gatsby-plugin-gatsby-cloud): Add disablePreviewUI option (#32907)
Browse files Browse the repository at this point in the history
* added pluginOptions from wrappRootElement

* updated access to the pluginOptions property and added the disabledPreivew property to the schema

Co-authored-by: Leithon Englidh <leithonenglidh@Leithons-MacBook-Air.local>
  • Loading branch information
2 people authored and wardpeet committed Aug 27, 2021
1 parent 0d5ee74 commit ed3d101
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/gatsby-plugin-gatsby-cloud/src/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ const ShadowPortal = ({ children, identifier }) => {
)
}

export const wrapRootElement = ({ element }) => {
if (process.env.GATSBY_PREVIEW_INDICATOR_ENABLED === `true`) {
export const wrapRootElement = ({ element }, pluginOptions) => {
if (
process.env.GATSBY_PREVIEW_INDICATOR_ENABLED === `true` &&
!pluginOptions?.disablePreviewUI
) {
return (
<>
{element}
Expand Down
3 changes: 3 additions & 0 deletions packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ const pluginOptionsSchema = function ({ Joi }) {
generateMatchPathRewrites: Joi.boolean().description(
`When set to false, turns off automatic creation of redirect rules for client only paths`
),
disablePreviewUI: Joi.boolean().description(
`When set to true, turns off Gatsby Preview if enabled`
),
})
}

Expand Down

0 comments on commit ed3d101

Please sign in to comment.