Skip to content
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(store): add selectSignal method for interop with Angular Signals #3856

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

brandonroberts
Copy link
Member

@brandonroberts brandonroberts commented Apr 23, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #

What is the new behavior?

Introduces the Store.selectSignal() method for returning a signal of the provided selector function

  • It accepts a selector function and returns a Signal of its value
  • It throws an error when used outside the injection context
    • Underlying issue here is the use of the select operator that uses the lift on the Observable to create a new instance of the Store. This is done outside the injection context, causing the error.
  • Docs incoming also

Does this PR introduce a breaking change?

[x] Yes
[ ] No

Other information

Converted almost entire NgRx example-app to use Store.selectSignal() for exploring, but will revert most of it.

@netlify
Copy link

netlify bot commented Apr 23, 2023

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit 50340a7
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/644843c8e1d0e40008079aa3

@brandonroberts brandonroberts force-pushed the feat-store-select-signal branch 4 times, most recently from 958fab5 to b54b042 Compare April 25, 2023 13:12
Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@brandonroberts brandonroberts force-pushed the feat-store-select-signal branch 2 times, most recently from 0ed9f47 to 26776da Compare April 25, 2023 18:35
Copy link
Member

@markostanimirovic markostanimirovic left a comment

Choose a reason for hiding this comment

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

It looks much better now! 🤘

Copy link
Member

@markostanimirovic markostanimirovic left a comment

Choose a reason for hiding this comment

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

🚀

@markostanimirovic markostanimirovic merged commit 999dcb6 into master Apr 25, 2023
@markostanimirovic markostanimirovic deleted the feat-store-select-signal branch April 25, 2023 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants