platform
platform copied to clipboard
Fields\Relation should respect the query's order
Is your feature request related to a problem? Please describe. The problem is that even if you apply a scope to order the results, the order goes back to ID. This is due to JSON.parse converting the ordered json into an JS object which has no native ordering.
Describe the solution you'd like
RelationController::builderItems() should return an array like [{value: 2, label: "First"},{value: 1, label: "Second"}] and relation_controller's search() promise could return response.data directly (skipping the Object.entries)
Describe alternatives you've considered RelationController::builderItems() needs to have the order explicit so that Javascript doesn't lose it. I don't see any other alternative.
Hi @vilocity-brian. Thanks for bringing this to my attention. Yes, I confirm that there is a problem and no JS object brute force method guarantees order preservation.
There seems to be no other option to fix this than what you suggested.