-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecross-cutting: resourceIssues related to the newly introduced resource / httpResourceIssues related to the newly introduced resource / httpResourceneeds: discussionIndicates than an issue is an open discussionIndicates than an issue is an open discussion
Milestone
Description
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
Yes
Description
I want to use some signal values for httpResource for request, but want to avoid api call when the signal value changes. I want to recall the api only when the user click apply.
Previously used rxResouce with loader, on calling reload it calls the loader and gets the latest params value.
// This works fine with reload
readonly data = rxResource({
loader: () => {
const params = { username: this.username(), page: this.page() };
return this.http.get('https://jsonplaceholder.typicode.com/posts', { params });
}
});
// This request fn not getting called on reload
readonly data = httpResource<MyData>(() => {
const params = untracked(() => {
// page and size changes frequently and want to avoid call on changes
return { username: this.username(), page: this.page(), size: this.size() };
});
return { url: 'https://jsonplaceholder.typicode.com/posts', params };
});
apply() {
// refetch the data only when user clicks reload
this.data.reload();
}Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecross-cutting: resourceIssues related to the newly introduced resource / httpResourceIssues related to the newly introduced resource / httpResourceneeds: discussionIndicates than an issue is an open discussionIndicates than an issue is an open discussion

