@@ -67,7 +67,7 @@ export class EntityOperations {
6767 }
6868
6969 for ( const state of StateIterator . eachSiblingRealm ( outerState ) ) {
70- const targetHasOneMarkers = this . resolveHasOneRelationMarkers ( getEntityMarker ( state ) . fields , fieldName , 'connect' )
70+ const targetHasOneMarkers = this . resolveHasOneRelationMarkers ( getEntityMarker ( state ) . fields , fieldName , 'connect' , state === outerState )
7171 for ( const targetHasOneMarker of targetHasOneMarkers ) {
7272 const previouslyConnectedState = state . children . get ( targetHasOneMarker . placeholderName )
7373
@@ -165,7 +165,7 @@ export class EntityOperations {
165165 const persistedData = this . treeStore . persistedEntityData . get ( outerState . entity . id . uniqueValue )
166166
167167 for ( const state of StateIterator . eachSiblingRealm ( outerState ) ) {
168- const targetHasOneMarkers = this . resolveHasOneRelationMarkers ( getEntityMarker ( state ) . fields , fieldName , 'disconnect' )
168+ const targetHasOneMarkers = this . resolveHasOneRelationMarkers ( getEntityMarker ( state ) . fields , fieldName , 'disconnect' , state === outerState )
169169 for ( const targetHasOneMarker of targetHasOneMarkers ) {
170170 const stateToDisconnect = state . children . get ( targetHasOneMarker . placeholderName )
171171
@@ -286,10 +286,14 @@ export class EntityOperations {
286286 container : EntityFieldMarkersContainer ,
287287 field : FieldName ,
288288 type : 'connect' | 'disconnect' ,
289+ mustExists : boolean ,
289290 ) : IterableIterator < HasOneRelationMarker > {
290291 const placeholders = container . placeholders . get ( field )
291292
292293 if ( placeholders === undefined ) {
294+ if ( ! mustExists ) {
295+ return
296+ }
293297 throw new BindingError ( `Cannot ${ type } at field '${ field } ' as it wasn't registered during static render.` )
294298 }
295299 const normalizedPlaceholders = placeholders instanceof Set ? placeholders : [ placeholders ]
0 commit comments