Skip to content

Commit 818d6c1

Browse files
leithonenglishLeithon Englidh
and
Leithon Englidh
authored
feat(gatsby-plugin-gatsby-cloud): Add disablePreviewUI option (#32907)
* 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>
1 parent f556a00 commit 818d6c1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/gatsby-plugin-gatsby-cloud/src/gatsby-browser.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ const ShadowPortal = ({ children, identifier }) => {
2828
)
2929
}
3030

31-
export const wrapRootElement = ({ element }) => {
32-
if (process.env.GATSBY_PREVIEW_INDICATOR_ENABLED === `true`) {
31+
export const wrapRootElement = ({ element }, pluginOptions) => {
32+
if (
33+
process.env.GATSBY_PREVIEW_INDICATOR_ENABLED === `true` &&
34+
!pluginOptions?.disablePreviewUI
35+
) {
3336
return (
3437
<>
3538
{element}

packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ const pluginOptionsSchema = function ({ Joi }) {
150150
generateMatchPathRewrites: Joi.boolean().description(
151151
`When set to false, turns off automatic creation of redirect rules for client only paths`
152152
),
153+
disablePreviewUI: Joi.boolean().description(
154+
`When set to true, turns off Gatsby Preview if enabled`
155+
),
153156
})
154157
}
155158

0 commit comments

Comments
 (0)