Skip to content

$effect not running in this case #14517

Closed Answered by brunnerh
moonlitgrace asked this question in Q&A
Discussion options

You must be logged in to vote

Dependencies are captured at effect run-time and speed is not used when the effect runs initially.

dotLottie.isLoaded is probably not reactive and the && causes typeof speed to never be evaluated here since this is a short circuit logical operator (if the left side is falsy, the right side is skipped).

If isLoaded were reactive and changed to true, this would work since then the entire if condition would be evaluated. If the DotLottie object is a third party class, you may have to add some additional logic to re-trigger the $effect on load.

See also this issue for more context:

As a workaround, you can switch around the order of the operators and move the speed check to the front…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@moonlitgrace
Comment options

Answer selected by moonlitgrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants