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(gatsby-plugin-gatsby-cloud): Add disablePreviewUI option #32907

Merged
merged 2 commits into from
Aug 26, 2021

Conversation

leithonenglish
Copy link
Contributor

Description

Added pluginOptions to wrappRootElement browser API function. Specifically added the "disablePreviewUI" property for enabling/disabling preview UI

Documentation

https://www.gatsbyjs.com/docs/reference/config-files/gatsby-browser/#wrapRootElement

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 25, 2021
export const wrapRootElement = ({ element }, pluginOptions) => {
if (
process.env.GATSBY_PREVIEW_INDICATOR_ENABLED === `true` &&
!pluginOptions.disablePreviewUI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!pluginOptions.disablePreviewUI
!pluginOptions?.disablePreviewUI

I can't remember if they have no options pluginOptions will be undefined or it will be an empty object. So let's just guard against it in case it is undefined

Copy link
Contributor

@DanielSLew DanielSLew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add our new pluginOption to the schema. You can see an example of it here

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-gatsby-cloud/src/gatsby-node.js#L131-L153

In this case it will just be a boolean

@LekoArts LekoArts changed the title added pluginOptions from wrappRootElement feat(gatsby-plugin-gatsby-cloud): Add disablePreviewUI option Aug 26, 2021
@LekoArts LekoArts added topic: plugins Related to plugin system, themes & catch-all for plugins that don't have a label and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 26, 2021
@DanielSLew DanielSLew merged commit 818d6c1 into master Aug 26, 2021
@DanielSLew DanielSLew deleted the 36428/add-plugin-option-to-disable-preview-ui branch August 26, 2021 19:29
wardpeet pushed a commit that referenced this pull request Aug 27, 2021
* added pluginOptions from wrappRootElement

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

Co-authored-by: Leithon Englidh <[email protected]>
This was referenced Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: plugins Related to plugin system, themes & catch-all for plugins that don't have a label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants