Weired! data is getting mixed between models
See original GitHub issueSteps to reproduce
On client side, Vuex store clone creates objects of other model/ plugin (with the same id) randomly and thus saves other model instead of currently edited object. Have reviewed both the front end (quasar) and backend (feathers) codes and it all looks neat (no model/ service mixup).
While editing say a Tax object, it clones the tax object as say Promo model object with data from both. If saved it saves promo object. Tax.vue
btnEdit(props) {
if (!props || !props.row) {
return;
}
this.thisTax = props.row.clone();
debug("thisTax", this.thisTax);
this.taxDialog = true;
},
btnSave() {
this.$v.thisTax.$touch();
if (this.$v.thisTax.$invalid) return;
this.loading = true;
this.thisTax
.save()
.then(response => {
this.$q.notify({
color: "positive",
message: `Tax saved ${response.id} - ${response.name}`
});
this.$v.$reset();
this.taxDialog = false;
this.thisTax = {};
this.loading = false;
})
.catch(e => {
this.loading = false;
this.$q.notify({
color: "negative",
message: `Error ${e}`
});
});
},
Sample plugin in store/index.js. All plugins are delcared like this
class Tax extends BaseModel {
// required
constructor(data, options) {
super(data, options)
}
// required
static modelName = 'Tax'
}
const taxPlugin = makeServicePlugin({
Model: Tax,
service: client.service('tax'),
enableEvents: false, // turn off socket event listeners. It's true by default
idField: 'id'
})
Expected behavior
clone Tax object and save the edited Tax item
Actual behavior
Instead of creating Tax object it creats another model object randomly say Promo with clubbed object properpties.
System configuration
"@feathersjs/authentication-client": "^4.3.11",
"@feathersjs/feathers": "^4.3.11",
"@feathersjs/socketio-client": "^4.3.11",
"feathers-vuex": "^2.2.5",
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
mixed model - Regression with 'stacked' data - Cross Validated
So, it's a cross sectional data, where you know there are groups of answers (color of jelly bean). You could try to run...
Read more >Understanding Mixed-Effects Models Through Data Simulation
In this Tutorial, we simulate data from a design with crossed random factors of subjects and stimuli, fit a model to the simulated...
Read more >Weird error in Generalized Linear Mixed Model (GLMM) in ...
I ran an experiment with factor X (2 levels) varied within-subjects, and factor Y (3 levels) varied between-subjects. The outcome is dichotomous.
Read more >confused by random effects structures in mixed models?
I recently came across a mixed model where the covariance between a random slope and intercept was 1 and wondered why.
Read more >THIS is how you compare mixed models in R. The ... - YouTube
Rather than advocating for "cook book" style analysis, this channel advocates for analytic strategies that dig deeper into the data at hand.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
feathers-vuex@3.0.1
I’ve figured out the cause.
copiesById
is on the BaseModel, not on the extended Model. This means every Model shares the samecopiesById
. I just haven’t noticed it because MongoDB’s ObjectID is unique. I’m working on the fix, now.