home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
4.12
  • Packages
    • @ember-data/adapter
    • @ember-data/adapter/error
    • @ember-data/adapter/json-api
    • @ember-data/adapter/rest
    • @ember-data/canary-features
    • @ember-data/debug
    • @ember-data/deprecations
    • @ember-data/experimental-preview-types
    • @ember-data/graph
    • @ember-data/json-api
    • @ember-data/legacy-compat
    • @ember-data/model
    • @ember-data/request
    • @ember-data/request/fetch
    • @ember-data/serializer
    • @ember-data/serializer/json
    • @ember-data/serializer/json-api
    • @ember-data/serializer/rest
    • @ember-data/store
    • @ember-data/tracking
  • Classes
    • <Interface> Adapter
    • <Interface> Cache
    • <Interface> Handler
    • <Interface> Serializer
    • AbortError
    • Adapter
    • AdapterError
    • BelongsToReference
    • BooleanTransform
    • BuildURLMixin
    • Cache
    • CacheManager
    • CacheStoreWrapper
    • CanaryFeatureFlags
    • ConflictError
    • CurrentDeprecations
    • DateTransform
    • DebugLogging
    • EmbeddedRecordsMixin
    • Errors
    • Fetch
    • ForbiddenError
    • Future
    • HasManyReference
    • IdentifierCache
    • InvalidError
    • JSONAPIAdapter
    • JSONAPISerializer
    • JSONSerializer
    • ManyArray
    • Model
    • NotFoundError
    • NotificationManager
    • NumberTransform
    • PromiseArray
    • PromiseManyArray
    • PromiseObject
    • RESTAdapter
    • RESTSerializer
    • RecordArray
    • RecordReference
    • RequestManager
    • RequestStateService
    • SchemaService
    • Serializer
    • ServerError
    • Snapshot
    • SnapshotRecordArray
    • StableRecordIdentifier
    • Store
    • StringTransform
    • TimeoutError
    • Transform
    • UnauthorizedError

Class SnapshotRecordArray public


Defined in: ../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:17
Module: @ember-data/legacy-compat

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


Methods

snapshots : Array public

Module: @ember-data/legacy-compat

Defined in ../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:146

returns
Array

Array of snapshots

Get snapshots of the underlying record array

Example

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

export default class PostAdapter extends JSONAPIAdapter {
  shouldReloadAll(store, snapshotArray) {
    let snapshots = snapshotArray.snapshots();

    return snapshots.any(function(ticketSnapshot) {
      let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
      if (timeDiff > 20) {
        return true;
      } else {
        return false;
      }
    });
  }
}

Properties

adapterOptions public

Module: @ember-data/legacy-compat

Defined in ../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:64

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) {
      // ...
    }
    // ...
  }
}

include public

Module: @ember-data/legacy-compat

Defined in ../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:88

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())
  }
}

length public

Module: @ember-data/legacy-compat

Defined in ../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:123

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;
  }
});

modelName public

Module: @ember-data/legacy-compat

Defined in ../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts:56

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

On this page


Methods

  • snapshots

Properties

  • adapterOptions
  • include
  • length
  • modelName
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2025 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue Created with Sketch.