Skip to content

Commit

Permalink
feat(gatsby): Partially release develop SSR to 5% (#28844)
Browse files Browse the repository at this point in the history
* feat(gatsby): Partially release develop SSR to 5%

* Fix typescript lint
  • Loading branch information
KyleAMathews authored Jan 5, 2021
1 parent 121ccbf commit 6b8cd5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
21 changes: 0 additions & 21 deletions packages/gatsby/src/services/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions packages/gatsby/src/utils/flags.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -90,9 +92,15 @@ const activeFlags: Array<IFlag> = [
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`,
Expand Down

0 comments on commit 6b8cd5d

Please sign in to comment.