diff --git a/packages/gatsby/src/services/initialize.ts b/packages/gatsby/src/services/initialize.ts index 4c90d0aa4e95c..579657ccc7547 100644 --- a/packages/gatsby/src/services/initialize.ts +++ b/packages/gatsby/src/services/initialize.ts @@ -10,8 +10,6 @@ import telemetry from "gatsby-telemetry" import apiRunnerNode from "../utils/api-runner-node" import handleFlags from "../utils/handle-flags" import { getBrowsersList } from "../utils/browserslist" -import { showExperimentNoticeAfterTimeout } from "../utils/show-experiment-notice" -import sampleSiteForExperiment from "../utils/sample-site-for-experiment" import { Store, AnyAction } from "redux" import { preferDefault } from "../bootstrap/prefer-default" import * as WorkerPool from "../utils/worker/pool" @@ -58,25 +56,6 @@ Please give feedback on their respective umbrella issues! telemetry.trackFeatureIsUsed(`FastDev`) } -if ( - process.env.gatsby_executing_command === `develop` && - !process.env.GATSBY_EXPERIMENTAL_DEV_SSR && - !isCI() && - sampleSiteForExperiment(`DEV_SSR`, 5) -) { - showExperimentNoticeAfterTimeout( - `Server Side Rendering (SSR) in Development`, - `gatsby.dev/dev-ssr-feedback`, - `which helps surface issues with build errors more quickly. Here's how to try it: - -module.exports = { - flags : { DEV_SSR: true }, - plugins: [...] -}`, - 1 // Show this immediately to the subset of sites selected. - ) -} - // Show stack trace on unhandled promises. process.on(`unhandledRejection`, (reason: unknown) => { // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33636 diff --git a/packages/gatsby/src/utils/flags.ts b/packages/gatsby/src/utils/flags.ts index c7fdc438021f7..a45ec75af1b4d 100644 --- a/packages/gatsby/src/utils/flags.ts +++ b/packages/gatsby/src/utils/flags.ts @@ -1,6 +1,8 @@ import _ from "lodash" import semver from "semver" +import sampleSiteForExperiment from "./sample-site-for-experiment" + // Does this experiment run for only builds type executingCommand = "build" | "develop" | "all" @@ -90,9 +92,15 @@ const activeFlags: Array = [ command: `develop`, telemetryId: `DevSsr`, experimental: false, - description: `SSR pages on full reloads during develop. Helps you detect SSR bugs and fix them without needing to do full builds.`, + description: `Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and fix them without needing to do full builds.`, umbrellaIssue: `https://gatsby.dev/dev-ssr-feedback`, - testFitness: (): fitnessEnum => true, + testFitness: (): fitnessEnum => { + if (sampleSiteForExperiment(`DEV_SSR`, 5)) { + return `OPT_IN` + } else { + return true + } + }, }, { name: `QUERY_ON_DEMAND`,