-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
chore(gatsby): enable query on demand (and lazy images) by default for local development #28787
Changes from 2 commits
9d2738d
8f8af73
ecef23b
ff4bf71
e22fc5e
4e76c5b
0308d2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,9 +85,7 @@ Object { | |
"umbrellaIssue": "test", | ||
}, | ||
], | ||
"message": " | ||
|
||
We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users | ||
Comment on lines
-88
to
-90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Result of adding checks before appending newlines to |
||
"message": "We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users | ||
and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release. | ||
|
||
We greatly appreciate your help testing the change. Please report any feedback good or bad in the umbrella issue. If you do encounter problems, please disable the flag by setting it to false in your gatsby-config.js like: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,17 +67,27 @@ const handleFlags = ( | |
// Test flags to see if it wants opted in. | ||
const optedInFlags = new Map<string, IFlag>() | ||
const applicableFlags = new Map<string, IFlag>() | ||
const lockedInFlags = new Map<string, IFlag>() | ||
const lockedInFlagsThatAreInConfig = new Map<string, IFlag>() | ||
availableFlags.forEach(flag => { | ||
const fitness = flag.testFitness(flag) | ||
|
||
// if user didn't explicitly set a flag (either true or false) | ||
// and it qualifies for auto opt-in - add it to optedInFlags | ||
if (typeof configFlags[flag.name] === `undefined` && fitness === `OPT_IN`) { | ||
const flagIsSetInConfig = typeof configFlags[flag.name] !== `undefined` | ||
|
||
if (fitness === `LOCKED_IN`) { | ||
enabledConfigFlags.push(flag) | ||
lockedInFlags.set(flag.name, flag) | ||
if (flagIsSetInConfig) { | ||
lockedInFlagsThatAreInConfig.set(flag.name, flag) | ||
} | ||
} else if (!flagIsSetInConfig && fitness === `OPT_IN`) { | ||
// if user didn't explicitly set a flag (either true or false) | ||
// and it qualifies for auto opt-in - add it to optedInFlags | ||
enabledConfigFlags.push(flag) | ||
optedInFlags.set(flag.name, flag) | ||
} | ||
|
||
if (fitness) { | ||
if (fitness === true || fitness === `OPT_IN`) { | ||
applicableFlags.set(flag.name, flag) | ||
} | ||
}) | ||
|
@@ -133,17 +143,33 @@ const handleFlags = ( | |
let message = `` | ||
// Create message about what flags are active. | ||
if (enabledConfigFlags.length > 0) { | ||
if (enabledConfigFlags.length - optedInFlags.size > 0) { | ||
if ( | ||
enabledConfigFlags.length - optedInFlags.size - lockedInFlags.size > | ||
0 | ||
) { | ||
message = `The following flags are active:` | ||
enabledConfigFlags.forEach(flag => { | ||
if (!optedInFlags.has(flag.name)) { | ||
if (!optedInFlags.has(flag.name) && !lockedInFlags.has(flag.name)) { | ||
message += generateFlagLine(flag) | ||
} | ||
}) | ||
} | ||
|
||
if (lockedInFlagsThatAreInConfig.size > 0) { | ||
if (message.length > 0) { | ||
message += `\n\n` | ||
} | ||
message += `Some features you configured with flags are now only and not configurable behavior. | ||
Those flags no longer have any effect and you can remove them from config:` | ||
pieh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
lockedInFlagsThatAreInConfig.forEach(flag => { | ||
message += generateFlagLine(flag) | ||
}) | ||
} | ||
|
||
if (optedInFlags.size > 0) { | ||
message += `\n\n` | ||
if (message.length > 0) { | ||
message += `\n\n` | ||
} | ||
message += `We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users | ||
and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release. | ||
|
||
|
@@ -178,7 +204,9 @@ The following flags were automatically enabled on your site:` | |
}) | ||
} | ||
|
||
message += `\n` | ||
if (message.length > 0) { | ||
message += `\n` | ||
} | ||
Comment on lines
+207
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was sometimes causing |
||
} | ||
|
||
return { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just "random" thing I spotted when looking for qod related changes I needed - we added those to
FAST_DEV
config flag but not toGATSBY_EXPERIMENTAL_FAST_DEV
env var route - I can drop those from here, but it would be weird forFAST_DEV
to only map toDEV_SSR
🤷