3 Comments

  1. Doug

    1st: I love it, thank you.

    I’m having a small problem with a ‘belongsTo’ relationship if the object which it belongs to is not yet created when the object is created. i.e.

    employee: belongsTo position
    position: hasMany employee

    If an employee is created before the position, the employee.position is forever ‘undefined’ and will not be reactive (or even found by jsData)

    Any Ideas??? Thanks again

    • munderwood

      That’s one that I haven’t encountered myself so far, but my first reaction (so to speak) is that if the relationship is not even found in js-data, then it’s really something to do with that, and not with Vue or its reactivity.

      The only thing I can think of off the top of my head without seeing more code would be if the position is being created only in the front end, and not persisted somewhere that would assign it an id. That is, if you say const bossPosition = store.createRecord({ title: 'CEO' }) then bossPosition.id will be undefined (until after a call to bossPosition.save() resolves), so assigning bossEmployee.position_id = bossPosition.id won’t actually do anything…

      • Doug

        It appears my issue is related to what you referenced above as as a possible infinite loop.

        I do need to have vueReactive set as true on both sides of some relations. Have you looked any more into this? Any ideas where I should start with debugging?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.