Skip to content

increased number of calls 'onResult' for 'useQuery' #1473

Answered by websitevirtuoso
akomratov asked this question in Q&A
Discussion options

You must be logged in to vote

Yes everything works as expected. From your code I can see

function onRequest() {
    console.log('-> onResult');
    ...
    const { onResult } = useQuery(gql(querySkillsPaged), gqlVariables, gqlQueryOptions);

    onResult(response => {
        console.log(' onResult(): data=', response.data);
        rows.value.splice(0, rows.value.length, ...(response.data?.skillsPaged ?? []))
    });
   ...
}

Rewrite to

onst { onResult } = useQuery(gql(querySkillsPaged), gqlVariables, gqlQueryOptions);

onResult(response => {
    console.log(' onResult(): data=', response.data);
    rows.value.splice(0, rows.value.length, ...(response.data?.skillsPaged ?? []))
});

function onRequest() {
    console…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Akryum
Comment options

You must be logged in to vote
0 replies
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
Converted from issue

This discussion was converted from issue #1457 on May 16, 2023 13:29.