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
leithonenglish and Leithon Englidh committed Aug 26, 2021
1 parent f556a00 commit 818d6c1
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
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
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 818d6c1

Please sign in to comment.