useAsyncData with possibly null or undefined key
I would like to know what is your approach when using
The problem I am facing is that I want to load a list of things which is dependent of a context. When this context changes I want to reload the list of things.
The issue is the context may be undefined at first as it is also fetched from the API.
The current behaviour I am seeing is that the call to fetch the list of things is performed twice at least.
I would like to only trigger a call to fetch the list of things when the context has a value (truthy) and when it changes.
useAsyncData with a key whose value is reactive/computed and at some point can be null or undefined.The problem I am facing is that I want to load a list of things which is dependent of a context. When this context changes I want to reload the list of things.
The issue is the context may be undefined at first as it is also fetched from the API.
The current behaviour I am seeing is that the call to fetch the list of things is performed twice at least.
I would like to only trigger a call to fetch the list of things when the context has a value (truthy) and when it changes.