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(effects): add provideEffects function #3524

Merged

Conversation

markostanimirovic
Copy link
Member

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 #3522

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@netlify
Copy link

netlify bot commented Aug 12, 2022

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 7570b63
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/6306642cb8281b00094d5adf

useValue: () => {
const effectsRunner = inject(EffectsRunner);
const effectSources = inject(EffectSources);
const shouldInitEffects = !effectsRunner.isStarted;
Copy link
Member

Choose a reason for hiding this comment

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

We should use a provider token here that checks to see if there is a parent token above this injector. If not then start the effects and we don't have to use property on the class

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure it would work when provideEffects is called multiple times within the context of the same injector.

modules/effects/src/provide_effects.ts Outdated Show resolved Hide resolved
@markostanimirovic markostanimirovic force-pushed the feat/effects/provide-effects branch 2 times, most recently from 639ed71 to 3898d51 Compare August 12, 2022 16:43
Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

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

🎉

@timdeschryver timdeschryver merged commit db35bfe into ngrx:master Aug 24, 2022
@timdeschryver
Copy link
Member

🚀🚀

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.

Effects: Introduce Standalone API for NgRx Effects
3 participants