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
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to ask if my way of using
useFragmentin 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
useQueryis coming from vue-apollo-composable. As you can see thepageprop in the PageLayout component is optional (because it is undefined until the query returns). This also means that the result ofuseFragmentis 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 executesuseFragmentwhen thepageprop is set. Is there a better way?Beta Was this translation helpful? Give feedback.
All reactions