Skip to content

Commit

Permalink
fixing asset eager loading
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Nov 17, 2023
1 parent f08c050 commit fb89802
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/actions/EagerLoadComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function handle(Collection $components)
foreach ($components as $component) {
foreach ($component->getType()->getFieldDefinitions() as $field) {
if ($field->className === Assets::class) {
$assets = collect($component->data->getRaw($field->handle) ?? [])
$componentData = collect($component->data->getRaw($field->handle) ?? [])
->map(fn ($id) => $assets->get($id))
->filter();
$component->data->populateRelation($field->handle, $assets);
$component->data->populateRelation($field->handle, $componentData);
}
}
}
Expand Down

0 comments on commit fb89802

Please sign in to comment.