Replies: 1 comment
-
Hi, I set a hookup to
and use the loadMissing() function to be assure that all my relations are correctly loaded. Still, i'm wandering if this should be really needed, i think maybe it would be possible for Livewire to manage the relations per row instead of loding only the minimum common relation of all of the rows. Thx |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
Laravel V11.0.8
Livewire V3.4.12
PHP 8.2
I'm having a strange issue with model relations. I'm not sure this is a bug or a misusage.
Now, say you add a 3rd row that has a null value on the level1 relation by design.
Imagine an invoice row that could be either :
If you add this row to the collection, upon rehydrating, for all of the 3 rows, the relations will only have the first level relation loaded (with no data for the 3rd row), but the 2nd level relation would not be loaded for the first 2 rows.
I would expect to get each row with their correct relations loaded.
If i check the ajax request, you see this data send back to the server :
OK.json
KO.json
You could see that the 2nd part of the lines object, the one that contain the IDs and the relations, that it contains only the 1st level relation when at least 1 row does not have this relation, the 2nd level is lost.
The array of lines has got the right relations for each row.
Any idea would be appreciated.
Thx
Beta Was this translation helpful? Give feedback.
All reactions