Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Moving CDN PreFetch to kick off prior to initialize call and added timeout logic #2666
Moving CDN PreFetch to kick off prior to initialize call and added timeout logic #2666
Changes from 8 commits
7840b15
0e63ccf
521b734
793c039
a30024f
a17d3d1
edfa7f3
c3addae
5f2faab
a2a0ae1
0d919f7
0f6483a
2beeffc
b21fc8d
74a6e89
3e85df8
2e94704
7fe8c40
d8ccea5
9d66560
381ce3e
d9704f3
da38ebf
cb29943
3034cd5
34bde9d
c3097b4
3bc52b5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Now that this is called in the global namespace this file has a side effect that it didn't used to have (loading the file in memory now automatically makes a call to the CDN). Can you verify with Noah that we don't need to mark this file in any particular way to prevent it from being treeshaken out?
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.
Good call, I'll follow up with Noah on this and if there's any issue I'll move this call into a separate funciton.
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.
Followed up with Noah, this will in fact introduce an unintended side effect that would make
app.ts
not treeshake-able. I'll be pushing out a change that will mitigate this or lessen the impact of the side effect.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.
Is there something we can do so issues like this are apparent to developers who introduce them without requiring @TrevorJoelHarris or @noahdarveau-MSFT to be manually looking for them in code reviews? Certainly I wouldn't have realized this.
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.
Hmmm, that's a good question. I'll think about it (and maybe ask @noahdarveau-MSFT). In general, any function calls in the global namespace are "side effects" if they cause some state somewhere to change because those functions will just get called assuming the entire module doesn't get tree-shaken out and removed. Off the top of my head I'm not sure there's a way to "detect" that.
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.
Okay, I am pretty sure that we could make a linter rule to detect global function calls that would show a warning saying something like "This file should probably be added to the sideEffects array in package.json. Once you've done that (or verified that you don't need to) please suppress this warning."