You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can use relatedEntitySelector and combine it with rootEntity to get a selector that returns books where the authorId field has been automatically looked up in my Author state to hydrate the author field.
Now let's say that' I have too many authors to load them all upfront. The authorId will most likely not find an entity matching authorId. It would be great to have a way to detect these misses.
I think that what currently happens in the callback defined in relatedEntity is that simply ignore the issue:
// Line ~120 in relatedEntity.tsconstvalueEntities=[];for(constidofids){if(!featureState.entities[id]){continue;// Ignore related ids that don't appear in the matching feature state}// ...entityValue={...featureState.entities[id]}asRELATED_ENTITY;// ...valueEntities.push(entityValue);}
Is there any suggestion or best practice to do that? If I haven't missed any build-in functionality, I guess my options are:
Put all of this logic further down the line once the selectors have returned my entities. Unfortunately at that point I need to define my relationships again, I can't just build upon what I've defined with relatedEntitySelector.
Re-define relatedEntity and before the above continue statement, do something interesting (most likely call a user-defined function).
Thank you.
The text was updated successfully, but these errors were encountered:
Let's say I have a
Book
entity likeI can use
relatedEntitySelector
and combine it withrootEntity
to get a selector that returns books where theauthorId
field has been automatically looked up in myAuthor
state to hydrate theauthor
field.Now let's say that' I have too many authors to load them all upfront. The
authorId
will most likely not find an entity matchingauthorId
. It would be great to have a way to detect these misses.I think that what currently happens in the callback defined in
relatedEntity
is that simply ignore the issue:Is there any suggestion or best practice to do that? If I haven't missed any build-in functionality, I guess my options are:
relatedEntitySelector
.relatedEntity
and before the abovecontinue
statement, do something interesting (most likely call a user-defined function).Thank you.
The text was updated successfully, but these errors were encountered: