vendredi 14 mai 2021

Getting a model is undefined error after upgrading to Ember 3.20.2

We have upgraded a few projects to use Ember 3.20.2 and we are working through issues and it's mostly going fine, but I have a really strange issue in one project.

We have retrieved records from the server as models, these models then get passed down a few levels through components and all the information about the model can be displayed in these components, except when we try and render one particular field on a template. The problem part of the template looks like:

<div title=>
    
</div>

and the model has the following:

details: DS.attr(),

The error that appears in the console looks like:

Uncaught TypeError: task is undefined
    Ember 2
        taskHelper
        fnWrapper
    deprecateMutationsInAutotrackingTransaction validator.js:149
    fnWrapper Ember
    computeTag reference.js:250
    runInAutotrackingTransaction validator.js:121
    track validator.js:774
    compute reference.js:249
    HelperRootReference reference.js:223
    Ember 2
        EmberHelperRootReference
        _lookupHelper
    ...

Is details now a restricted word? Some other issue?

Edit:

Actually I think I have narrowed down what the error is. It doesn't seem to like the title being . If I remove the title attribute everything seems to be working fine. The documentation for deprecateMutationsInAutotrackingTransaction is:

/**
     * Switches to deprecating within an autotracking transaction, if one exists.
     * If `runInAutotrackingTransaction` is called within the callback of this
     * method, it switches back to throwing an error, allowing zebra-striping of
     * the types of errors that are thrown.
     *
     * Does not start an autotracking transaction.
     *
     * NOTE: For Ember usage only, in general you should assert that these
     * invariants are true.
     */

which may suggest why some title attributes are failing, but I cannot make out much from that documentation.




Aucun commentaire:

Enregistrer un commentaire