-
-
Notifications
You must be signed in to change notification settings - Fork 364
[Live] Fix checksum calculation for deeply nested data #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2f0af8d
to
5b0b862
Compare
@1ed Can you give a hint about what your component looked like that suffered from this issue? I could add a test case |
It's a big live form with an autocomplete multi-select inside a live collection type and Tom-Select rearranges options sometimes. [
"data" => 2,
"formName" => "project",
"project" => [
"name" => "name",
"participatingDepartments" => [
[
"department" => "1",
"members" => ["0" => "12", "1" => "289", "2" => "290"],
],
],
],
"isValidated" => false,
"validatedFields" => [],
]; e.g. |
Dude, THAT has been the bane of my existence 😆. TomSelect works great, but the internals are ugly - and this unnecessary rearranging (and then it depending internally on the order it just made) made a mess for getting it working with live components.
To make sure I understand, what does that If you're on 2.8, then I'm missing some piece to the puzzle. When we dehydrate the component, we send those exact props + checksum to the live component. Then, those exact props + checksum are sent back on an Ajax request (on a key called Thanks! |
I've tried to write some tests too but can not figure it out yet. I'll try to create a simple reproducer. |
@weaverryan I have the same issue :( No Tomselect here, just a form with a Dto. |
It shouldn't, but it's possible. You can see that the order is suddenly wrong? It'd be interesting to see what the |
data-live-props-value : {
"data":1132,
"formName":"add_to_cart_event",
"add_to_cart_event":{
"addToCartTicketingModels":{
"2618":{
"quantity":"0"
},
"2632":{
"quantity":"0"
},
"2619":{
"quantity":"0"
},
"2620":{
"quantity":"0"
}
},
"_token":"5b0402.hVyZMfpiUUDyIM6v9cFyT2jqooFuHnHPkLE39sIVYHQ.xD7fbpEtOzqjcvievKk1PzjTlt4CUxO91uhYwqZNJzHJJMFHvTE4ebFalw"
},
"isValidated":false,
"validatedFields":[
],
"@checksum":"mV1EXCTdg39uFjZ9hlmUTsXuALRxu7k5F0fEs5zaY0s="
} Submitted Ajax :
As you can see something reorder |
Ah! Fascinating! Well, it doesn't really matter what is doing it - though it may be as simple as the The point is: you've exposed the bug, so let's get this merged. |
Thanks @1ed! |
For a consistent checksum we need to sort the whole input.