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(explicitEffect): addition of defer parameter; this parameter all… #431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mauriziocescon
Copy link

@mauriziocescon mauriziocescon commented Jun 19, 2024

As part of the discussion related to explicit deps tracking for the effect function, @JeanMeche delivered the implementation of explicitEffect. 🎉

This is a small PR that complements the initial implementation by adding an optional defer parameter in order to skip the initial callback call (by design effects run once).

Here is a scenario describing its usage: angular/angular#56155 (comment)

Note that the other frameworks have a similar functionality:

As part of the PR, I've also reworked a bit the doc (hope you don't mind).

…ows the computation not to execute immediately and only run on first deps change.
@JeanMeche
Copy link
Contributor

With the upcomming changes to effect, I not sure this is a good idea.

See angular/angular#56501, we'll have root effects and component effects.

@mauriziocescon
Copy link
Author

mauriziocescon commented Jun 19, 2024

Umh... noticed the PR, but I'm not sure I get all the details (probably I'll wait for your blog-post 😅).

In few words: same effect function with different behaviours depending on component and (for example) root service? I was anyway assuming the nature of effects (always run at least once) was unchanged (defer = skip first callback call)...

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.

None yet

2 participants