Skip to content

Commit

Permalink
feat(gatsby): add partial hydration flag (gatsbyjs#36436)
Browse files Browse the repository at this point in the history
* add partial hydration flag

* delete pkjson update

* adjust flag

* dry constraint check

* Update packages/gatsby/src/utils/flags.ts

Co-authored-by: Ward Peeters <[email protected]>
  • Loading branch information
marvinjude and wardpeet authored Aug 25, 2022
1 parent b8c2072 commit 41de1f0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/gatsby/src/utils/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,27 @@ const activeFlags: Array<IFlag> = [
},
]

if (_CFLAGS_.GATSBY_MAJOR === `5`) {
activeFlags.push({
name: `PARTIAL_HYDRATION`,
env: `GATSBY_PARTIAL_HYDRATION`,
command: `build`,
telemetryId: `PartialHydration`,
description: `Enable partial hydration to reduce Total Blocking Time and Time To Interactive `,
umbrellaIssue: `https://gatsby.dev/partial-hydration-umbrella-issue`,
experimental: true,
testFitness: (): fitnessEnum => {
const v18Constraint = {
react: `>=18.0.0`,
}
const v0Constraint = {
react: `0.0.0`,
}

return satisfiesSemvers(v18Constraint) || satisfiesSemvers(v0Constraint)
},
requires: `Requires React v18 or above.`,
})
}

export default activeFlags

0 comments on commit 41de1f0

Please sign in to comment.