Releases: embermap/ember-data-storefront
v0.16.0
Breaking changes
This is the last release with breaking changes, we've settled on storefront's data loading API.
reloadWith has been renamed to sideload.
model.reloadWith
is now model.sideload
. reloadWith
is deprecated, but will continue to work until we release version 1.0.0
.
The method name sideload
better communicates what storefront is actually doing, sideloading a model's relationships.
Load options
All of storefront's APIs now support reload
and backgroundReload
options. These allow you to control how the promise resolves and if network requests are made when data is already in the store.
The reload
option will force storefront to always fetch data and return a blocking promise, even if data is already in the store.
this.store.loadRecords('post', { reload: true });
this.store.loadRecord('post', 1, { reload: true });
post.load('comments', { reload: true });
post.sideload('comments', { reload: true });
The backgroundReload
option can be used to prevent storefront from making a network request if the data has already been loaded. This is useful for data that won't change during the application's lifecycle.
this.store.loadRecords('country', { backgroundReload: false });
this.store.loadRecord('country', 'US', { backgroundReload: false });
country.load('states', { backgroundReload: false });
country.sideload('states', { backgroundReload: false });
Upgrading from 0.15
Rename all instances of reloadWith
to sideload
.
Storefront users who want to upgrade from 0.14 will need to update any calls to loadAll
in their code to loadRecords
.
- return post.reloadWith('author,comments');
+ return post.sidelod('author,comments');
That's it! You're all set.
v0.15.0
Breaking changes
loadAll has been renamed to loadRecords.
store.loadAll
is now store.loadRecords
. loadAll
is deprecated, but will continue to work until we release version 1.0.0
.
The naming of loadAll
was too close to findAll
, by renaming the function loadRecords
it is clear that this is not a 1-to-1 substitute for findAll
.
store.findAll
will load all records as well as return a live binding to all records in the store. This mean that as new models are created, or loaded from elsewhere, they will appear in the list returned by findAll
.
Similarly, store.loadRecords
will also load all records. However, it will not return a live binding to the store. This means that any records created, or loaded from elsewhere, will not appear in this list returned from loadRecords
.
Upgrading from 0.14
Storefront users who want to upgrade from 0.14 will need to update any calls to loadAll
in their code to loadRecords
.
model() {
- return this.get('store').loadAll('post');
+ return this.get('store').loadRecords('post');
}
That's it! You're all set.
Matching findAll
's behavior
Storefront users who wish to match Ember Data's findAll
behavior should use loadRecords
to load data and store.peekAll
to access data.
async model() {
- return this.get('store').findAll('post');
+ await this.get('store').loadRecords('post');
+ return this.get('store').peekAll('post');
}
Since peekAll
will return a live binding to the store this route retains that same behavior as findAll
.
v0.14.2
Touching up the docs site.
v0.14.1
v0.14.0
Breaking changes
New methods to load and sideload relationships that align with Ember Data's APIs
The model.load('relationship')
method now uses Ember Data's references API to load the given relationship. This allows storefront to work with links provided by your backend. It also gives storefront better support for async relationships.
The old behavior of the load
method has moved to model.reloadWith('relationship')
. This API still relies on JSON:API includes to load related data.
For users of 0.13.x, the quickest way to upgrade would be to replace all calls to model.load
with model.reloadWith
.
The code for this change is in #47
This fixes the issues in #33
v0.13.2
v0.13.1
Use Object assign polyfill from Ember. Fixes IE11 bug.
v0.13.0
The store
service is no longer injected into the LoadableModel mixin. Since this mixin is made to be used with an Ember Data model we can rely on the store property being present. This fixes a bug when directly using the mixin on a model would error.
v0.12.2
Added the Fastboot Adapter mixin.
v0.12.1
The new LoadableStore
mixin is now automatically mixed into the host application's store.
The deprecated storefront
service was throwing errors on install, which is now fixed.