Skip to content

feat(http): add cache & priority support for fetch requests in httpRe… #62301

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

Conversation

SkyZeroZx
Copy link
Contributor

@SkyZeroZx SkyZeroZx commented Jun 26, 2025

Currently, Angular's httpResource doesn't expose the cache & priority option from the underlying Fetch API. This feature would allow developers to control of request and improve better performance ( web vitals ).

Example new usage :

httpResource(() => ({
  url: '/assets/hero.jpg',
  method: 'GET',
  priority: 'high',
  cache : 'force-cache'
}));

@pullapprove pullapprove bot requested a review from alxhub June 26, 2025 18:22
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: common/http Issues related to HTTP and HTTP Client labels Jun 26, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 26, 2025
@SkyZeroZx SkyZeroZx force-pushed the add-cache-priority-options-httpResource branch from 11b6bd0 to c3e4bfa Compare June 26, 2025 18:31
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed and removed requires: TGP This PR requires a passing TGP before merging is allowed labels Jun 26, 2025
@SkyZeroZx SkyZeroZx force-pushed the add-cache-priority-options-httpResource branch from 3bd8186 to d005f41 Compare June 26, 2025 18:53
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed and removed requires: TGP This PR requires a passing TGP before merging is allowed labels Jun 26, 2025
@SkyZeroZx SkyZeroZx force-pushed the add-cache-priority-options-httpResource branch from dccada1 to 1f3a927 Compare June 26, 2025 19:16
@milomg milomg removed their request for review June 26, 2025 19:29
@josephperrott josephperrott force-pushed the add-cache-priority-options-httpResource branch from 1f3a927 to ebfb1dd Compare June 26, 2025 21:12
…source

This commit adds support for the Fetch API's cache & priority options when using httpResource with the withFetch provider
@SkyZeroZx SkyZeroZx force-pushed the add-cache-priority-options-httpResource branch from ebfb1dd to c164762 Compare June 27, 2025 03:47
@devversion devversion requested review from pkozlowski-opensource and removed request for devversion June 27, 2025 06:32
Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

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

LGTM!

reviewed-for: fw-general, public-api

@thePunderWoman thePunderWoman added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Jun 27, 2025
@pullapprove pullapprove bot requested review from alxhub and crisbeto June 27, 2025 09:15
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

Reviewed-for: public-api

@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 55fa38a.

The changes were merged into the following branches: main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: common/http Issues related to HTTP and HTTP Client detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants