Skip to content

v0.16.1

Compare
Choose a tag to compare
@ryanto ryanto released this 10 Apr 20:29
· 370 commits to master since this release

Fixed a bug where loadRecords would not track includes [#66]

loadRecords will now track the includes it was called with, which allows models that enter the store with loadRecords to work with assert-must-preload. See #66 for the bug report.

There's also the potential for this bug fix to change the behavior of your app. Since models loaded with loadRecords weren't aware of their includes, they would always block the first time a relationship was loaded.

Before this bugfix, this is how storefront behaved:

// Prior to the bugfix
let posts = this.store.loadRecords('post', { include: 'comments' });
posts.firstObject.hasLoaded('comments') // => false
posts.firstObject.load('comments') // => blocking promise until the data is loaded

With this release, the new behavior is:

// After the bugfix
let posts = this.store.loadRecords('post', { include: 'comments' });
posts.firstObject.hasLoaded('comments') // => true
posts.firstObject.load('comments') // => instantly resolving promise + background reload