Skip to content

refactor(core): use stream in rxResource instead of loader#59910

Closed
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:refactor/rx-resource-with-stream
Closed

refactor(core): use stream in rxResource instead of loader#59910
cexbrayat wants to merge 1 commit intoangular:mainfrom
cexbrayat:refactor/rx-resource-with-stream

Conversation

@cexbrayat
Copy link
Copy Markdown
Member

@cexbrayat cexbrayat commented Feb 10, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

With the changes in #59573, resource can now define a stream rather than a loader. In the same PR, rxResource was updated to leverage this new functionality to handle multiple responses from the underlying observable, rather than just the first one as it was previously.

What is the new behavior?

This commit renames the loader option of rxResource into stream to be better aligned with its new behavior.

The previous version is temporarily kept and marked as deprecated to help migrating the current usage.

Does this PR introduce a breaking change?

  • Yes
  • No (still experimental)

Other information

This was briefly discussed with @alxhub on Slack

@pullapprove pullapprove bot requested a review from atscott February 10, 2025 22:32
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Feb 10, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 10, 2025
@cexbrayat cexbrayat force-pushed the refactor/rx-resource-with-stream branch 3 times, most recently from d54029f to 56895b2 Compare February 10, 2025 23:01
Copy link
Copy Markdown
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.

reviewed-for: public-api

@pullapprove pullapprove bot requested a review from mmalerba February 19, 2025 17:34
With the changes in angular#59573, `resource` can now define a `stream` rather than a `loader`.
In the same PR, `rxResource` was updated to leverage this new functionality to handle multiple responses from the underlying observable,
rather than just the first one as it was previously.
This commit renames the `loader` option of `rxResource` into `stream` to be better aligned with its new behavior.

The previous version is temporarily kept and marked as deprecated to help migrating the current usage.

Before
```
usersResource = rxResource({
  request: () => ...,
  loader: ({ request }) => ...
});
```

After
```
usersResource = rxResource({
  request: () => ...,
  stream: ({ request }) => ...
});
```
@cexbrayat cexbrayat force-pushed the refactor/rx-resource-with-stream branch from 56895b2 to ee18be2 Compare February 19, 2025 20:24
@pullapprove pullapprove bot requested a review from mmalerba February 19, 2025 20:26
@pullapprove pullapprove bot requested a review from mmalerba February 19, 2025 20:26
Copy link
Copy Markdown
Contributor

@mmalerba mmalerba 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

@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Apr 7, 2025
@atscott
Copy link
Copy Markdown
Contributor

atscott commented Apr 8, 2025

This PR was merged into the repository by commit 98a584c.

The changes were merged into the following branches: main, 19.2.x

@atscott atscott closed this in 98a584c Apr 8, 2025
atscott pushed a commit that referenced this pull request Apr 8, 2025
With the changes in #59573, `resource` can now define a `stream` rather than a `loader`.
In the same PR, `rxResource` was updated to leverage this new functionality to handle multiple responses from the underlying observable,
rather than just the first one as it was previously.
This commit renames the `loader` option of `rxResource` into `stream` to be better aligned with its new behavior.

The previous version is temporarily kept and marked as deprecated to help migrating the current usage.

Before
```
usersResource = rxResource({
  request: () => ...,
  loader: ({ request }) => ...
});
```

After
```
usersResource = rxResource({
  request: () => ...,
  stream: ({ request }) => ...
});
```

PR Close #59910
JeanMeche added a commit to JeanMeche/angular that referenced this pull request Apr 9, 2025
@JeanMeche JeanMeche reopened this Apr 9, 2025
@JeanMeche
Copy link
Copy Markdown
Member

We had to revert the change since it introduced a breakage inside g3. (the loader property was still used there).

atscott pushed a commit that referenced this pull request Apr 9, 2025
atscott pushed a commit that referenced this pull request Apr 9, 2025
@atscott atscott added state: blocked and removed action: merge The PR is ready for merge by the caretaker labels Apr 9, 2025
@cexbrayat
Copy link
Copy Markdown
Member Author

Thanks for the feedback @JeanMeche
The PR was supposed to still allow the usage of loader as it is only deprecated. Is there something else that I need to do?

@JeanMeche
Copy link
Copy Markdown
Member

Alex picked up that change with others in #60919.

@JeanMeche JeanMeche closed this Apr 18, 2025
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: core Issues related to the framework runtime state: blocked target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants