Skip to content

Clarity on when / if I need to call .release() on an effect reference? #4312

Answered by ekwoka
bennadel asked this question in 1. Help
Discussion options

You must be logged in to vote

x-effect cleans it up (though you make me worry). the effect utility passed to directives auto registers the release to the cleanup of the directive.

The effect will stick around so long as the data exists.

And you can potentially get into contexts where effects and data make a web of stuff where only one thing is directly used but it keeps a bunch of stuff around.

You should clean up your manually created effects (with Alpine.effect) once you no longer need them. It will be much harder to hunt down the cause of such a web of effects if you just ignore it for later.

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
2 replies
@bennadel
Comment options

@ekwoka
Comment options

Answer selected by bennadel
Comment options

You must be logged in to vote
12 replies
@bennadel
Comment options

@bennadel
Comment options

@ekwoka
Comment options

@bennadel
Comment options

@ekwoka
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants