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 RequestStateService public


Defined in: ../store/src/-private/network/request-cache.ts:31
Module: @ember-data/store

The RequestStateService is used to track the state of requests for fetching or updating known resource identifies that are inflight.


Methods

getLastRequestForRecord (identifier) : RequestState | null public

Module: @ember-data/store

Defined in ../packages/store/src/-private/network/request-cache.ts:210

identifier
StableRecordIdentifier
returns
RequestState | null

the state of the most recent request for the given identifier

Retrieve the last completed request for a given resource identity.

getPendingRequestsForRecord (identifier) : RequestState[] public

Module: @ember-data/store

Defined in ../packages/store/src/-private/network/request-cache.ts:195

identifier
StableRecordIdentifier
returns
RequestState[]

an array of request states for any pending requests for the given identifier

Retrieve all active requests for a given resource identity.

subscribeForRecord (identifier, callback) public

Module: @ember-data/store

Defined in ../packages/store/src/-private/network/request-cache.ts:159

identifier
StableRecordIdentifier
callback
(state: RequestState) => void

Subscribe to requests for a given resource identity.

The callback will receive the current state of the request.

interface RequestState {
  state: 'pending' | 'fulfilled' | 'rejected';
  type: 'query' | 'mutation';
  request: Request;
  response?: { data: unknown };
}

Note: It should be considered dangerous to use this API for more than simple state derivation or debugging. The request and response properties are poorly spec'd and may change unexpectedly when shifting what Handlers are in use or how requests are issued from the Store.

We expect to revisit this API in the near future as we continue to refine the RequestManager ergonomics, as a simpler but more powerful direct integration with the RequestManager for these purposes is likely to be a better long-term design.

On this page


Methods

  • getLastRequestForRecord
  • getPendingRequestsForRecord
  • subscribeForRecord
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.