-
Notifications
You must be signed in to change notification settings - Fork 26.2k
feat(common): verify that priority images have corresponding preconnect links #46053
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
feat(common): verify that priority images have corresponding preconnect links #46053
Conversation
83379f8
to
58bbe5e
Compare
@AndrewKushnir would you mind rebasing this PR? Kind of hard to review it in the current state. |
da056c4
to
eedc837
Compare
@pkozlowski-opensource the PR is now rebased, thanks for the comment. |
eedc837
to
67b8f14
Compare
Summarizing offline discussion:
|
67b8f14
to
7287fed
Compare
a118df6
to
c340be2
Compare
* @param blockFn function to wrap. The function can return promise or be `async`. | ||
* @publicApi | ||
*/ | ||
export function withHead<T extends Function>(html: string, blockFn: T): T { |
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.
Note to the reviewers: I will create a separate PR against the main Angular branches and land it. This PR would not contain this change, it's just there at this moment for completeness (to make things work).
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.
The PR with those changes for the main Angular branches: #46250.
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.
Thanks for making all the changes! A few minor things below
packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts
Outdated
Show resolved
Hide resolved
packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts
Outdated
Show resolved
Hide resolved
packages/common/src/directives/ng_optimized_image/ng_optimized_image.ts
Outdated
Show resolved
Hide resolved
c340be2
to
1071c52
Compare
7b9569d
to
7173711
Compare
This commit updates the `NgOptimizedImage` directive to add a logic to detect whether an image, marked with the "priority" attribute has a corresponding `<link rel="preconnect">` tag in the `document.head` for better performance.
adde7c5
to
f77dee3
Compare
491a693
to
e67331b
Compare
…hecks in NgOptimizedImage This commit adds an extra logic to add an ability to exclude origins from preconnect checks in NgOptimizedImage by configuring the `PRECONNECT_CHECK_BLOCKLIST` multi-provider.
e67331b
to
08b5322
Compare
@kara @pkozlowski-opensource FYI this PR is updated and is ready for the final review. Thank you. |
packages/common/src/directives/ng_optimized_image/preconnect_link_checker.ts
Show resolved
Hide resolved
packages/common/src/directives/ng_optimized_image/preconnect_link_checker.ts
Outdated
Show resolved
Hide resolved
packages/common/src/directives/ng_optimized_image/preconnect_link_checker.ts
Show resolved
Hide resolved
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.
@AndrewKushnir I did another pass on this PR and left a couple of nit / question comments but things LGTM overall.
The only open question I've got is the usage of a multiprovider for the preconnect blocklist. Since the application author / "integrator" is in charge of adding the procennect links it should be, IMO, an app responsibility to configure loaders, add preconnect tags etc.
In my head other modules (ex. 3rd party loaded from NPM) should have no say in this blocklist. Let's discuss in person as we've got a dedicated meeting today.
Quick update: after an offline discussion, the |
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.
LGTM
…nnect checks in NgOptimizedImage
d7a3b91
to
61d393c
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit updates the
NgOptimizedImage
directive to add a logic to detect whether an image, marked with the "priority" attribute has corresponding<link rel="preconnect">
tag in thedocument.head
.PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?