So I have a supabase select query with a JOIN that seems to be working when I log the results to console in the browser, but when I try to use the data from the JOIN, the result is null. The data also shows as null in the terminal console log.
Here is my query:
<script lang="ts" context="module">
import { supabase } from '../supabase';
export async function load({ params }) {
const slug = params.slug;
const { data, error } = await supabase
.from('babies')
.select(
'babyName, babyMiddle, babyLast, birthday, gender, lbs, message, oz, weight, profiles ( first_name, partners_name )'
)
.eq('slug', slug);
When I console.log the data object in the browser, it looks like:
{
"babyName": "Test",
"babyMiddle": "",
"babyLast": "Last",
"birthday": null,
"gender": "Boy",
"lbs": null,
"message": "",
"oz": null,
"weight": false,
"profiles": {
"first_name": "Joe",
"partners_name": "Jen"
}
But in the terminal console it looks like this (notice profiles is null):
{
babyName: 'Test',
babyMiddle: '',
babyLast: 'Last',
birthday: null,
gender: 'Boy',
lbs: null,
message: '',
oz: null,
weight: false,
profiles: null
}
Trying to set the data to a store writeable gives me an error because the value is null.