apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Async / Promise Variables

Open kukoo1 opened this issue 6 years ago • 3 comments

Variables option in smart query isn't being waited for async variables function to be resolved before fetching.

apollo: {
        list: {
            query,
            async variables() {
                const data = await getData();
                return { data };
            },
       },
},
`

kukoo1 avatar Nov 08 '19 19:11 kukoo1

Is there any solution to this?

liyasthomas avatar Mar 07 '21 07:03 liyasthomas

any update on this? is there any solution?

miguel-rrc avatar Aug 17 '21 22:08 miguel-rrc

In these cases, I load required data elsewhere (mounted, on some event, whatever is appropriate) and use the skip() option of vue-apollo to wait until the data is available to run.

charlie-s avatar Mar 11 '22 21:03 charlie-s