Open RyanClementsHax opened 3 weeks ago
Correct me if I'm wrong, but you will always get an array of results unless you use .single()
at the end of a query,
i.e
const { data } = await supabase.from("time_off_requests").select(`
id,
user:profiles!profile_id (
id,
name,
avatar_url
),
approver:profiles!approver_id (
id,
name,
avatar_url
)
`).single() // <-------;
Oh, I'd like an array to be returned for the table I'm querying, but I'd like the approver field on every row to be a single object. The client returns the data just fine but the typescript types don't line up.
Bug report
The closest I found to this problem is the following discussions
Describe the bug
Let's say I have the following two tables.
The following query...
...resolves as...
...but the data comes back as...
To Reproduce
See above steps
Expected behavior
One to many joins of this type shouldn't be typed as arrays i.e.
Screenshots
N/A
System information
Additional context
Temporary workaround I'm using