Skip to content

Commit 62d7535

Browse files
committedDec 19, 2024
fix emergent behavior support in legacy relationships support
1 parent 1c413bf commit 62d7535

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

Diff for: ‎packages/model/src/-private/legacy-relationships-support.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,13 @@ export class LegacySupport {
189189
if (relatedIdentifier === null) {
190190
return null;
191191
} else {
192-
const toReturn = store._instanceCache.getRecord(relatedIdentifier);
193192
assert(
194193
`You looked up the '${key}' relationship on a '${identifier.type}' with id ${
195194
identifier.id || 'null'
196195
} but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (\`belongsTo(<type>, { async: true, inverse: <inverse> })\`)`,
197-
toReturn === null || store._instanceCache.recordIsLoaded(relatedIdentifier, true)
196+
store._instanceCache.recordIsLoaded(relatedIdentifier, true)
198197
);
199-
return toReturn;
198+
return store._instanceCache.getRecord(relatedIdentifier);
200199
}
201200
}
202201
}
@@ -523,7 +522,7 @@ export class LegacySupport {
523522
// in order to prevent infinite re-render if the request
524523
// fails.
525524
if (this._pending[key]) {
526-
return this._pending[key]!;
525+
return this._pending[key];
527526
}
528527

529528
const identifier = resource.data ? resource.data : null;
@@ -563,7 +562,7 @@ export class LegacySupport {
563562
.finally(() => {
564563
this._pending[key] = undefined;
565564
});
566-
return this._pending[key]!;
565+
return this._pending[key];
567566
}
568567

569568
const preferLocalCache = hasReceivedData && allInverseRecordsAreLoaded && !isEmpty;
@@ -599,7 +598,7 @@ export class LegacySupport {
599598
.finally(() => {
600599
this._pending[key] = undefined;
601600
});
602-
return this._pending[key]!;
601+
return this._pending[key];
603602
}
604603

605604
// we were explicitly told we have no data and no links.

0 commit comments

Comments
 (0)