Class SnapshotRecordArray

public

SnapshotRecordArray is not directly instantiable. Instances are provided to consuming application's adapters for certain requests.

Show:

A hash of adapter options passed into the store method for this request.

Example

app/adapters/post.js
import MyCustomAdapter from './custom-adapter';

export default class PostAdapter extends MyCustomAdapter {
  findAll(store, type, sinceToken, snapshotRecordArray) {
    if (snapshotRecordArray.adapterOptions.subscribe) {
      // ...
    }
    // ...
  }
}

The relationships to include for this request.

Example

app/adapters/application.js
import Adapter from '@ember-data/adapter';

export default class ApplicationAdapter extends Adapter {
  findAll(store, type, snapshotRecordArray) {
    let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;

    return fetch(url).then((response) => response.json())
  }
}

Number of records in the array

Example

app/adapters/post.js
import JSONAPIAdapter from '@ember-data/adapter/json-api';

export default class PostAdapter extends JSONAPIAdapter {
  shouldReloadAll(store, snapshotRecordArray) {
    return !snapshotRecordArray.length;
  }
});

The modelName of the underlying records for the snapshots in the array, as a Model