Skip to content
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

only include isomorphic-fetch if the application has explicitly disabled native fetch #838

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apaleslimghost
Copy link
Member

this will allow us to gradually enable native fetch in apps without a breaking change. by default, apps on Node 18 using Tool Kit set this flag. once everything has migrated to native fetch we can remove the dependency on isomorphic-fetch.

@apaleslimghost apaleslimghost requested review from a team as code owners July 31, 2024 10:48
…led native fetch

this will allow us to gradually enable native fetch in apps without a breaking change.
@apaleslimghost apaleslimghost force-pushed the apaleslimghost-patch-1 branch from 8383054 to a80344f Compare July 31, 2024 10:49
Comment on lines +11 to +12
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') &&
process.execArgv.includes('--no-experimental-fetch')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: not that we support said versions anymore, but process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') resolving to false implies that this is an older Node version without support for native fetch so we should fallback to isomorphic-fetch in that case

Suggested change
process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') &&
process.execArgv.includes('--no-experimental-fetch')
!process.allowedNodeEnvironmentFlags.has('--no-experimental-fetch') ||
process.execArgv.includes('--no-experimental-fetch')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh very good point

@@ -6,7 +6,13 @@
* @typedef {import("./typings/metrics").TickingMetric} TickingMetric
*/

require('isomorphic-fetch');
// only include isomorphic-fetch if the application has explicitly disabled native fetch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: could we expand this comment to add a bit of context on why we're doing this? afaict it's to satisfy problem hub as there won't be any behavioural change (as isomorphic-fetch already checks if native fetch is present)

Copy link
Member Author

@apaleslimghost apaleslimghost Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this idea is from Jen's original native fetch investigation. which i should have read a bit closer, because the reason she's suggesting doing it this way is so we can add a warning here. i'll do that. maybe?

Comment on lines +77 to +78
message:
"The 'withAb' option is deprecated and no longer supported by n-express or n-flags-client"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like prettier or something edited an unrelated bit of code. The config seems wrong because ESLint is complaining about double quotes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bike shedding territory:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants