Skip query option is triggering a request #388
Unanswered
robsontenorio
asked this question in
Q&A
Replies: 1 comment
-
@robsontenorio I faced the same issue, but in fact you're missing something. I suggest you do the following: export default {
apollo: {
user: {
query: findUserQuery,
variables () {
return { id: this.$route.params.id }
},
skip () {
if (this.$route.params.id === 'add') {
// this will fetch data from backend
this.$apollo.queries.user.skip = true
}
}
}
},
data () {
return {
user: {
posts: []
// more empty attributes in here
}
}
} That should work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The same page/view handles
/users/<some-id>
(edit) and/users/add
(add) routes.So, when some id is provided (ex
/users/99
) it will fetch the user data and works fine. But, when route is/user/add
a request is sent to backend even withskip
set.Am i missing something? Is something related to apollo/component life cycle?
Beta Was this translation helpful? Give feedback.
All reactions