Updating from 3.2.83 to 3.2.84 break custom component
So we have a custom component that stopped working between these 2 version.
I've attached the Resource and Component: https://gist.github.com/mrleblanc101/714180585a24a82383f8fbd5b0e5dccd
26 Replies
If I edit the data in phpMyAdmin directly, the data is show correcly in the component, so only the save is not working.
If I revert t 3.2.83 everything works as you can see
I've isolated the issue to this change (L228), any idea what is happening ?
Anyone has an idea ?
Can you update to 3.2.102? It’s the latest so you’re a little behind. Possibly 84 had a bug that has been fixed.
Yes I did try, it doesn't work either.
That's because of the change I showed in the screenshot above, there has been to other change to that file since patch 84
Does it work on create?
The field is hidden on create, I'd have to try but I'm out and I don't have my laptop with me (just my phone)
No worries. I’m on my phone too.
No hurry.
If I add line 228 back by editing the source in vendor, it works again
Nothing is standing out to me about your code that wouldn’t work. But I would also expect other reports if it was a bug.
I think must be related to the pivot
Where is the relationship? Not seeing it in the gist?
I would start debugging in the getPracticeData() method. Make sure you are getting the right state to start with during hydration and dehydration.
I think the state is ok, because everything is fine if I edit in phpMyAdmin. Just the save that doesn't work anymore
Which tells me something could be going wrong during the dehydration.
Again, though, I don’t see any relationship on the field so not sure where or how you are saving that.
I'll try to provide more data once I get home, this is on a private Gitlab instance so I can't share easily
No worries.
On the Product resource I have this:
Any particular reason for not just using the ->relationship() method and letting filament just handle it.
Are you overriding the save or mutate methods on the EditProduct page?
I don't know what you mean. I'm pretty new to Filament
I don't think so. Do you mean in the Filament resource ? No
What is in Filament\Resources\Product\Pages\EditProduct.php in your app.
Oh god, I didn't even know about those file lol. I'm sorry as I said I'm not the one that made that code, only trying to debug why the update broke it
There is that:
Might be a good place to debug next
Hmm. Yea. Something could definitely be going wrong there.
Yeah I'll put some dd() and check what is happening
Honestly I thought everything was handled by Filament directly
Since I couldn't find where the save was happening
It typically would be if the relationship was setup and implemented correctly, but there’s times when you need to be explicit. Just don’t know enough about the app to know if it’s needed or not.
I think the goal was being able to edit all the row of the relationship (and the 2 pivot fields) directly, but maybe that possible natively ?
We are coming from Laravel Nova where this wasn't possible.
@awcodes I think i got it be removing the
beforeStateDehydrated
.
I have no idea what purpose it served, I can't even find documentation about this function in the doc.
I guess 3.2.84 fixed a bug where the beforeStateDehydrated
was not called, but we didn't need it in the first place ? 🤷♂️
Thanks for your help !