-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Description
In v2 Arrayable props are only converted to arrays if they are "regular" props. This happens because closures are resolved later than arrayable props: see here
IMHO this conversion should happen either on all forms of prop definition or never.
One solution would be to move resolveArrayableProperties
after resolvePropertyInstances
, this solves this issue but I did not test the effects on the whole system.
Backstory:
We use spatie media library in our project and passed the MediaCollection directly to the inertia view. After the v2 upgrade we noticed that ['propname' => $collection]
and ['propname' => fn () => $collection]
behaves differently.
This happens because
['propname' => $collection]
callstoArray
because of the Arrayable check but['propname' => fn () => $collection]
is not doing this so it will be fall back totoJson
in the end which has a different implementation.
andrasszommer
Metadata
Metadata
Assignees
Labels
No labels