Skip to content

Commit

Permalink
identifier may be undefined with peekRecordIdentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Oct 15, 2020
1 parent 66c545b commit 04d8bb0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/store/addon/-private/system/core-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1442,14 +1442,16 @@ abstract class CoreStore extends Service {
const resource: ResourceIdentifierObject = constructResource(type, normalizedId);

if (RECORD_ARRAY_MANAGER_IDENTIFIERS) {
let identifier: StableRecordIdentifier = identifierCacheFor(this).getOrCreateRecordIdentifier(resource);
if (RECORD_REFERENCES.has(identifier)) {
return RECORD_REFERENCES.get(identifier);
}
let identifier: StableRecordIdentifier | undefined = identifierCacheFor(this).peekRecordIdentifier(resource);
if (identifier) {
if (RECORD_REFERENCES.has(identifier)) {
return RECORD_REFERENCES.get(identifier);
}

let reference = new RecordReference(this, identifier);
RECORD_REFERENCES.set(identifier, reference);
return reference;
let reference = new RecordReference(this, identifier);
RECORD_REFERENCES.set(identifier, reference);
return reference;
}
} else {
return internalModelFactoryFor(this).lookup(resource).recordReference;
}
Expand Down

0 comments on commit 04d8bb0

Please sign in to comment.