Closed mdrews21 closed 2 months ago
I can't immediately see any issues with this code that would explain the lack of reactivity. getData
is a 'standard' pinia getter, so should behave reactively (equivalent to a component).
This code is effectively what happens in the testapp
in examples
for comparison. If you want to play with that, check out this repo and run npm run dev
then play with the Patch fields in the form.
One possibility is that your patch is making a deep change that isn't being spotted by the reactivity system, so you may need to try a deep watcher to see if that's why it's being missed.
The only other debugging I can think to suggest is that since getData
is a getter, you should be able to use it 'directly'. So you can use e.g. <pre>{{ store.getData({_jv: {type: "tasks", id: id} }) }}</pre>
somewhere in your template to see changes.
Im sorry for my late response. I tested with the example and found out, that there must be an issue using the ofetch Library shipped with Nuxt 3. Switched back to axios and reactivity is back... I don't know why but it worked
I neeed your Advice on following issue: I don't get a reactive state from model in pinia-jsonapi store. Every time I patch the model the store is updated, but the computed property in my component isn't.
E.g. The tasks are fetched in parent component with
The store looks like that afterwards:
Changing the checkbox value in child component triggers a
store.patch()
request. The pinia-jsonapi store is updated with the updated model. But the computed propertyconst task = computed()
still has the old attributes.Can you please give me an advice what I am doing wrong?
Here is my:
Composable <useJsonapi()>:
Composable <useOFetchApi()>: