Skip to content

Commit

Permalink
fix: make implicit relationship teardown following delete of related …
Browse files Browse the repository at this point in the history
…record safe (emberjs#8705)
  • Loading branch information
runspired authored and jrjohnson committed Jul 28, 2023
1 parent 02db7e0 commit 4bbc173
Show file tree
Hide file tree
Showing 2 changed files with 1,099 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/graph/src/-private/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ export class Graph {
const keys = Object.keys(relationships);
for (let i = 0; i < keys.length; i++) {
const relationship: RelationshipEdge = relationships[keys[i]];
// account for previously unloaded relationships
// typically from a prior deletion of a record that pointed to this one implicitly
if (relationship === undefined) {
continue;
}
assert(`Expected a relationship`, relationship);
if (relationship.definition.inverseIsAsync) {
return false;
Expand Down
Loading

0 comments on commit 4bbc173

Please sign in to comment.