hasura / ra-data-hasura

react-admin data provider for Hasura GraphQL Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sanitizeResource transform arrays of arrays into arrays of objects.

JosepC12 opened this issue · comments

Issue Description:
I have come across an issue with the sanitizeResource function in ra-data-provider. The function's current implementation transforms arrays of arrays into an array of objects with the index as keys. This is causing unexpected behavior in my application.

This behavior is problematic for scenarios where the original array structure needs to be preserved, like, for example in a jsonb field.

Steps to Reproduce:

Use the sanitizeResource function with a record containing a jsonb which contains an array of arrays as input.
Notice that the function converts the array of arrays into an array of objects.
[[1, 2, 3, 4,]] => [{0:1, 1:2, 2:3, 3:4}]
Expected Behavior:
I would expect the sanitizeResource function to preserve the original array structure when encountering an array of arrays.

Environment:

ra-data-provider version: ˆ0.5.6
Node.js version: v16.20.0
Operating System: MacOS 13.2.1

Thank you for your attention to this matter. Let me know if you require any further information or clarification.