feathersjs-ecosystem / feathers-vuex

Integration of FeathersJS, Vue, and Nuxt for the artisan developer
https://vuex.feathersjs.com
MIT License
445 stars 108 forks source link

find relational subdocument data with no FeathersVuex from 2nd time on 1.7.0 #398

Closed flight9 closed 4 years ago

flight9 commented 4 years ago

Steps to reproduce

Expected behavior

Every time, the subdocuments of result are with FeathersVuex

Actual behavior

The 1st time, the subdocuments of result are with FeathersVuex(see pic): with-feathersvuexmodel-1130_1

But from the 2nd time, the subdocuments of result are without FeathersVuex(see pic): without-feathersvuexmodel-1130_2

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working): 1.7.0 - 1.7.2

    "@feathersjs/authentication-client": "^1.0.2",
    "@feathersjs/commons": "4.0.0",
    "@feathersjs/feathers": "^3.1.7",
    "@feathersjs/socketio-client": "^1.1.0",
    "feathers-vuex": "^1.7.2",
    "socket.io-client": "^2.1.1"

NodeJS version: 8.9.3

Client Version: quasar v.0.17.20

marshallswain commented 4 years ago

I'm sorry that you can't upgrade to 2.0. That really puts you in a tough situation because this is definitely fixed in 2.0 and now 3.0. I'll at least give you some guidance. The magic to fix this bug all lies in the new mergeWithAccessors utility that came with 2.0+. You can find it here: https://github.com/feathersjs-ecosystem/feathers-vuex/blob/master/src/utils.ts#L409

If you make a pull request that makes sure that all database responses that modify store data go through that function, it should maintain the Vue reactivity of the model instances instead of overwriting the records with plain objects.

So you'll want to start by copying that into the code for 1.7. I believe I even managed to figure out tests for this. The vue test-utils are pretty fickle for me, meaning they rarely work at all for me, so I work around them as best as I can.

marshallswain commented 4 years ago

I'm going to go ahead and close this, since I cannot get to it any time soon. Please reopen if you plan on working on it.