question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Weired! data is getting mixed between models

See original GitHub issue

Steps 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).

Screenshot from 2019-12-19 14-18-52

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.

Screenshot from 2019-12-19 14-25-39

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:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
marshallswaincommented, Dec 20, 2019

Fixed in feathers-vuex@3.0.1

1reaction
marshallswaincommented, Dec 20, 2019

I’ve figured out the cause. copiesById is on the BaseModel, not on the extended Model. This means every Model shares the same copiesById. I just haven’t noticed it because MongoDB’s ObjectID is unique. I’m working on the fix, now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found