With this little bit of code we can allow the select field to receive an object rather than just an integer, this is very useful for when a REST API sends nested data rather than just ID's that are references to the data.
Rather than
{ "id": 1, "name": "John Doe", "job": 1 }
we can now pass something like this
{ "id": 1, "name": "John Doe", "job": { "title": "Manager", "id": 1 } }
With this little bit of code we can allow the select field to receive an object rather than just an integer, this is very useful for when a REST API sends nested data rather than just ID's that are references to the data.
e.g
with the field set up like so:
Rather than
{ "id": 1, "name": "John Doe", "job": 1 }
we can now pass something like this{ "id": 1, "name": "John Doe", "job": { "title": "Manager", "id": 1 } }