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
Loading something twice as on a polymorphic relationship and somewhere else (included as of a nested relationship), imagine something like:
// PostController.phppublicfunctionindex(JsonApiResponse$response)
{
return$response->using(Post::with([
'parent' => fn (MorphTo$morphTo) => $morphTo->morphWith([
Group::class => [
'createdBy', // this being user ID = 2
],
]),
'author', // this being user ID = 2'author.avatars', // load avatars from post.author relationship thought groups will not have access to this!
]));
}
This will get into a race condition where author relationship (in this case could be of type user) will be different sometimes at the included data array because the user is actually the same in both relationships...
The text was updated successfully, but these errors were encountered:
Similar issue happening but with a race-condition on the merge:
publicfunctionindex(JsonApiResponse$response)
{
return$response->using(Post::with([
'updatedBy', // this being user ID = 2'author', // this being user ID = 2'author.avatars', // load avatars from post.author relationship thought race-condition will exclude this in favor of the first found in the array
]));
}
Replication example
Loading something twice as on a polymorphic relationship and somewhere else (included as of a nested relationship), imagine something like:
This will get into a race condition where author relationship (in this case could be of type
user
) will be different sometimes at theincluded
data array because the user is actually the same in both relationships...The text was updated successfully, but these errors were encountered: