-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Feature Request
Right now, if an @fetch action is used within data-effect the expression is executed when any signal changes. This can be quite surprising, and also makes data-effect not very useful with @fetch actions unless they are wrapped in a @peek. Even if you use the filterSignals option the expression still fires on every signal.
I propose that the @fetch actions have the peek built in, so that they don't trigger data-effect at all themselves. If the user desires triggering an expression on every signal change there is already data-on-signal-patch which can be a drop in replacement for that particular case.
This would allow something like data-effect="$mySignal; @get('/my/route')" to only run when mySignal changes. Right now you'd have to either data-effect="$mySignal; @peek(() => @get('/my/route'))" or data-on-signal-patch="@get('/my/route')" data-on-signal-patch-filter="{include: /^mySignal$/}". If you want the current behavior you'd change to data-on-signal-patch="@get('/my/route')"
Datastar Version
v1.0.0-RC.6