Writable computed inside a pinia store #2764
Replies: 1 comment 5 replies
-
Creating writable computed is fine, you can consume the store directly |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How might one go about using writable computeds in a Pinia store with Vue3?
I'm able to create a computed that reads values and upon using it in conjunction with v-model also writes values to the correct place. Unfortunately, I haven't been able to create a testable solution for this, because storeToRefs doesn't return WritableComputed and there's apparently no alternate utility for it either.
My use case is, that I have a data structure with gaps, so my computed returns the data or an empty array, whereas in the set method it creates the needed structure if it was missing, otherwise just sets its value.
Beta Was this translation helpful? Give feedback.
All reactions