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.

Record "isDirty=true" via [relationship].willDestory

See original GitHub issue

Version

3.8.1

Test Case

Model:

import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
export default class ProjectModel extends Model {
    @attr('string') projectName;
    @belongsTo('engagement') engagement;
    @belongsTo('collectionperiod') collectionPeriod;
    @attr('string') owner;
    @attr proxyUsers;
    @hasMany('team-criteria', {inverse: 'project'}) teams;
}

Template:

{{#with (changeset this.dataManagement.currentProject changesetKeys=this.projectChangesetKeys) as |projectChangeset|}}

...

{{/with}}

Expected Behavior

Model upon load is not dirty as no changes have happened.

Actual Behavior

projectChangeset.changes is reporting:

[
    {
        "key": "engagement.willDestroy"
    },
    {
        "key": "teams.willDestroy"
    },
    {
        "key": "_oldWillDestroy"
    },
    {
        "key": "willDestroy"
    }
]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
csprocket777commented, Aug 10, 2020

No, I think we can close this. I discovered that the error had something to do with modifying the wrong record and thinking I had the correct one. I had to pass in a reference to the model I was modifying in the @onChange handler of the power-select instance so that I could be explicit as to what I was updating. Thank you for your help.

0reactions
snewcomercommented, Aug 10, 2020

Ya that was wwhat #525 was looking to verify and it seems all tests are passing. If you had a test case that was failing, I’m sure we could come up with a solution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ember-data.js - gists · GitHub
We call the record to which a relationship belongs the. relationship's _owner_ ... Add records to a transaction using the `add()` method: ......
Read more >
'[webkit-changes] [216735] trunk/PerformanceTests' - MARC
NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try ... + // if all of type `connection` must...
Read more >
Download Diff File - Gitea
Similar to regular injection rules, but are run against factories, via - `Registry#lookupFactory`. - These rules are used to inject objects onto factories ......
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