How to use Vue ref value assigned in a useQuery as the enabled option in another useQuery?
vue script setup includes (psuedo code):
The second useQuery function runs without the enabled option, but it runs twice (first time is invalid since var is an empty string). However when I add the enabled option it never runs, even though var value is updated by the first useQuery function
1 Reply
magic-amber•3y ago
Hi, you are probably make the classic mistake of unwrapping the value prematurely or computing the value for enabled without reactivity in place.
This way
enabled will get a value computed just for initial render.
You need to use computed, ref or reactive and pass that to enabled without unwrapping. Ex.