Skip to content

Documentation / @ember-data/store / index / recordIdentifierFor

Call Signature

ts
function recordIdentifierFor<T>(record): StableRecordIdentifier<TypeFromInstance<T>>;

Defined in: packages/store/src/-private/caches/instance-cache.ts:62

Retrieves the unique referentially-stable RecordIdentifier assigned to the given record instance.

js
import { recordIdentifierFor } from "@ember-data/store";
// ... gain access to a record, for instance with peekRecord or findRecord
const record = store.peekRecord("user", "1");
// get the identifier for the record (see docs for StableRecordIdentifier)
const identifier = recordIdentifierFor(record);
// access the identifier's properties.
const { id, type, lid } = identifier;

Type Parameters

T

T extends TypedRecordInstance

Parameters

record

T

a record instance previously obstained from the store.

Returns

StableRecordIdentifier<TypeFromInstance<T>>

Call Signature

ts
function recordIdentifierFor(record): StableRecordIdentifier;

Defined in: packages/store/src/-private/caches/instance-cache.ts:65

Retrieves the unique referentially-stable RecordIdentifier assigned to the given record instance.

js
import { recordIdentifierFor } from "@ember-data/store";
// ... gain access to a record, for instance with peekRecord or findRecord
const record = store.peekRecord("user", "1");
// get the identifier for the record (see docs for StableRecordIdentifier)
const identifier = recordIdentifierFor(record);
// access the identifier's properties.
const { id, type, lid } = identifier;

Parameters

record

unknown

a record instance previously obstained from the store.

Returns

StableRecordIdentifier

Released under the MIT License.