File tree 1 file changed +6
-9
lines changed
packages/json-api/src/-private
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -1973,15 +1973,12 @@ function setupRelationships(
1973
1973
identifier : StableRecordIdentifier ,
1974
1974
data : ExistingResourceObject
1975
1975
) {
1976
- // TODO @runspired iterating by definitions instead of by payload keys
1977
- // allows relationship payloads to be ignored silently if no relationship
1978
- // definition exists. Ensure there's a test for this and then consider
1979
- // moving this to an assertion. This check should possibly live in the graph.
1980
- for ( const [ name , field ] of fields ) {
1981
- if ( ! isRelationship ( field ) ) continue ;
1982
-
1983
- const relationshipData = data . relationships ! [ name ] ;
1984
- if ( ! relationshipData ) continue ;
1976
+ for ( const name in data . relationships ! ) {
1977
+ const relationshipData = data . relationships [ name ] ;
1978
+ const field = fields . get ( name ) ;
1979
+ // TODO consider asserting if the relationship is not in the schema
1980
+ // we intentionally ignore relationships that are not in the schema
1981
+ if ( ! relationshipData || ! field || ! isRelationship ( field ) ) continue ;
1985
1982
1986
1983
graph . push ( {
1987
1984
op : 'updateRelationship' ,
You can’t perform that action at this time.
0 commit comments