Skip to content

Commit

Permalink
feat(gatsby): remove concurrent-features flag and depend on export (#…
Browse files Browse the repository at this point in the history
…31818) (#31830)

(cherry picked from commit 34b6d47)

Co-authored-by: Ward Peeters <ward@coding-tech.com>
  • Loading branch information
GatsbyJS Bot and wardpeet committed Jun 8, 2021
1 parent 2a4ea62 commit d8c948c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 41 deletions.
19 changes: 5 additions & 14 deletions packages/gatsby/cache-dir/app.js
Expand Up @@ -31,15 +31,6 @@ module.hot.accept([

window.___emitter = emitter

if (
process.env.GATSBY_EXPERIMENTAL_CONCURRENT_FEATURES &&
!ReactDOM.createRoot
) {
throw new Error(
`The GATSBY_EXPERIMENTAL_CONCURRENT_FEATURES flag is not compatible with your React version. Please install "react@0.0.0-experimental-2bf4805e4" and "react-dom@0.0.0-experimental-2bf4805e4" or higher.`
)
}

const loader = new DevLoader(asyncRequires, matchPaths)
setLoader(loader)
loader.setApiRunner(apiRunner)
Expand Down Expand Up @@ -141,10 +132,7 @@ apiRunnerAsync(`onClientEntry`).then(() => {
// render to avoid React complaining about hydration mis-matches.
let defaultRenderer = ReactDOM.render
if (focusEl && focusEl.children.length) {
if (
process.env.GATSBY_EXPERIMENTAL_CONCURRENT_FEATURES &&
ReactDOM.createRoot
) {
if (ReactDOM.createRoot) {
defaultRenderer = ReactDOM.createRoot
} else {
defaultRenderer = ReactDOM.hydrate
Expand Down Expand Up @@ -208,7 +196,10 @@ apiRunnerAsync(`onClientEntry`).then(() => {
<LoadingIndicatorEventHandler />
)
} else {
renderer(<LoadingIndicatorEventHandler />, indicatorMountElement)
ReactDOM.render(
<LoadingIndicatorEventHandler />,
indicatorMountElement
)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/gatsby/cache-dir/production-app.js
Expand Up @@ -193,9 +193,7 @@ apiRunnerAsync(`onClientEntry`).then(() => {
const renderer = apiRunner(
`replaceHydrateFunction`,
undefined,
process.env.GATSBY_EXPERIMENTAL_CONCURRENT_FEATURES
? ReactDOM.createRoot
: ReactDOM.hydrate
ReactDOM.createRoot ? ReactDOM.createRoot : ReactDOM.hydrate
)[0]

domReady(() => {
Expand Down
24 changes: 0 additions & 24 deletions packages/gatsby/src/utils/flags.ts
Expand Up @@ -182,30 +182,6 @@ const activeFlags: Array<IFlag> = [
umbrellaIssue: `https://gatsby.dev/functions-feedback`,
testFitness: (): fitnessEnum => `LOCKED_IN`,
},
{
name: `CONCURRENT_FEATURES`,
env: `GATSBY_EXPERIMENTAL_CONCURRENT_FEATURES`,
command: `all`,
telemetryId: `ConcurrentFeatures`,
experimental: true,
description: `Enable React's concurrent features`,
// umbrellaIssue: `https://gatsby.dev/concurrent-features`,
testFitness: (): fitnessEnum => {
// Because of this, this flag will never show up
const semverConstraints = {
react: `^0.0.0-experimental-2bf4805e4`,
"react-dom": `^0.0.0-experimental-2bf4805e4`,
}

if (satisfiesSemvers(semverConstraints)) {
return true
} else {
// react & react-dom is either not installed or not new enough so
// just disable — it won't work anyways.
return false
}
},
},
{
name: `LMDB_STORE`,
env: `GATSBY_EXPERIMENTAL_LMDB_STORE`,
Expand Down

0 comments on commit d8c948c

Please sign in to comment.