I need to replace the useResult function that is fetching data from GraphQL with a computed function.
const locationOptions = useResult(
result,
[],
({ getLocations }): Option[] => formatOptions(getLocations)
)
Instead, I want to change it to a computed function like this:
const locationOptions = computed(() => result.value.getLocations ?? [])
I tried using a watch to run the function but it doesn't seem to be working:
watch(locationOptions, () => {
formatOptions(locationOptions.value)
})
Any suggestions on how to make this work?