Reactivity and useFragment in vue #9300
Unanswered
KammererTob
asked this question in
Q&A
Replies: 1 comment
-
So far I've found success in specifying it as a computed property instead, e.g:
Which for me has automatically updated the fragment every time that the prop is updated. |
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
-
I wanted to ask if my way of using
useFragment
in my Vue application is correct, or if there is a better way i am missing.Consider the following two components (in pseudo-code).
PageLayout
UserPage
while
useQuery
is coming from vue-apollo-composable. As you can see thepage
prop in the PageLayout component is optional (because it is undefined until the query returns). This also means that the result ofuseFragment
is undefined at the start. The issue i am having is that the component is not rerendered when the result actually comes in. What are my options here? It works if i make the props reactive and use a watcher which only executesuseFragment
when thepage
prop is set. Is there a better way?Beta Was this translation helpful? Give feedback.
All reactions