Success updating with status 204, but logged data is null

I was updating a row, it was successfully updated, but when i log the result, the data is null. here's my code: model
updateExperience: (id, title, company, detail, startDate, endDate) =>
new Promise((resolve, reject) => {
supabase
.from("experience")
.update({
title,
company,
detail,
start_date: startDate,
end_date: endDate,
})
.eq("id", id)
.then((result) => {
if (!result.error) {
resolve(result);
} else {
reject(result);
}
});
}),
updateExperience: (id, title, company, detail, startDate, endDate) =>
new Promise((resolve, reject) => {
supabase
.from("experience")
.update({
title,
company,
detail,
start_date: startDate,
end_date: endDate,
})
.eq("id", id)
.then((result) => {
if (!result.error) {
resolve(result);
} else {
reject(result);
}
});
}),
and in controller:
const result = await experienceModel.updateExperience(
experienceId,
title,
company,
detail,
startDate,
endDate
);
const result = await experienceModel.updateExperience(
experienceId,
title,
company,
detail,
startDate,
endDate
);
when i log the result:
{
error: null,
data: null,
count: null,
status: 204,
statusText: 'No Content'
}
{
error: null,
data: null,
count: null,
status: 204,
statusText: 'No Content'
}
when i check the table, data is updated but the log didn't show it. i do the same way in my last project, and it was fine.
No description
3 Replies
NanoBit
NanoBit3y ago
Is this supabase v1 or v2 I’m not sure if an update will return the updated data in v2
garyaustin
garyaustin3y ago
NanoBit is correct v2 requires you add .select() at end.
Beteer
BeteerOP3y ago
thank you, now data is showing looks like im using v2, after adding .select(), it shows the data

Did you find this page helpful?