You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Created a button which execute the composite function. the input value is 1.
function onClickFire2() {
let result = loadCarByPk(undefined, { id: inputId.value })
console.log("loadCarByPk, result -> ", result)
if (!result) {
console.log("refetch")
refetchCarByPk({ idList: inputId.value })
}
}
Following is my onResult
onResultCarByPk((result) => {
const { loading, data } = result
if (!loading) {
console.log("data -> ", data.car_by_pk)
}
})
To Reproduce
Steps to reproduce the behavior:
Click on the button to trigger function. The following is my console.log()
loadCarByPk, result -> Promise {<pending>}
data -> {__typename: 'car', id: 1, name: 'Impreza WRX'}
Click on the button second time to trigger the function again. The following is my console.log()
loadCarByPk, result -> false
refetch
data -> {__typename: 'car', id: 1, name: 'Impreza WRX'}
data -> {__typename: 'car', id: 1, name: 'Impreza WRX'}
Expected behavior
By looking at the document useLazyQuery
My expected behavior is that on the second time when I click the button, useLazyQuery return a false and we should execute the refetch() as per the document
function fetchOrRefetch () {
load() || refetch()
}
I'm thinking that this issues should belongs to "@apollo/client" more than "@vue/apollo-composable"? since the issues lies on how the useLazyQuery() treat the second execution.
Apollo Client Issue
I have raised the same issue at apollo client but someone hinted that "return value from load hook" is not a core concept within apollo client.
Describe the bug
I have created a composition function of car.
Created a button which execute the composite function. the input value is 1.
Following is my onResult
To Reproduce
Steps to reproduce the behavior:
Expected behavior
By looking at the document
useLazyQuery
My expected behavior is that on the second time when I click the button, useLazyQuery return a false and we should execute the refetch() as per the document
Versions
"vue": "^3.5.12",
"@vue/apollo-composable": "4.2.1",
"@apollo/client": "^3.11.8",
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: