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.

Unchanged hasMany causing isDirty

See original GitHub issue

I’m working on some code to autosave my model. It looks like:

export default Route.extend({
  autosave: task(function * () {
    yield timeout(3000);
    this.get('model').save();
  }).restartable(),

  model(params) {
    return this.store.findRecord('task', params.taskId);
  },

  afterModel(model) {
    this.set('model', model);
  },

  modelChanged: observer('model.isDirty', function() {
    if(this.get('model.isDirty')) {
      window.console.log(this.get('model').changed());
      this.get('autosave').perform();
    }
  })
});

I have the model configured with: changeTracker: { trackHasMany: true, auto: true, enableIsDirty: true }

When I change a string “deliverables” attribute in the model, I get on the console:

{deliverables: Array(2), subscribers: true}
{subscribers: true}
{}

Why does it think subscribers changed? subscribers is modeled as: subscribers: hasMany('user', {inverse: null})

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
danielspanielcommented, Aug 5, 2019

wow … this is blast from the past. but i would suggest you make a PR and write a test or make the fix in the change tracker repo, that way I can check it out and see if it makes sense. I still don’t follow the test and for sure you can’t do a fix where you open the ember-data store. that not going to make anyone happy. but if you can do a better fix or explain the issue in a test ( in change tracker ) then I happy to check it out

1reaction
danielspanielcommented, Sep 19, 2017

oooo … this sounds like a bug.
can you do me a huge favour and make a test to show this ( broken behaviour ) and slap it in a PR so I can fix it / see the breaking thing / check it out that way?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Here's what may happen if you do not change your underwear ...
Unclean panties cause irritation to the skin because of bacterial buildup down there. Sweating, dead skin or microbe infestations are common ...
Read more >
6 Signs of Low Transmission Fluid
Dark, dirty or burnt-smelling fluid are signs that the fluid is old and no longer effective. Your transmission filter likely needs to be...
Read more >
Why does the loss/accuracy fluctuate during the training ...
There are several reasons that can cause fluctuations in training loss over epochs. The main one though is the fact that almost all...
Read more >
Recordkeeping - Detailed Guidance for OSHA's Injury and ...
... factors have played a tangible role in causing the injury or illness, ... STS concept in the context of a hearing conservation...
Read more >
JPA EntityManager: Why use persist() over merge()?
This new book has many new information then former one. ... merge and persist methods whose overlapping behavior may cause confusion not only...
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