© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
4 replies
Deleted User

How to get data back from an update?

I have a function that updates the username for a user. But, the data returned is always null. Is this by design and I need to refetch the updated user profile or am I doing something wrong?

export const handleUpdateUsername = async (id: string, username: string) => {
  const { data, error } = await supabase
    .from('profiles')
    .update({ username: username })
    .match({ id: id })
    .single();

  if (error) {
    console.log('error', error);
    return error;
  } else {
    console.log('data', data);
    return data;
  }
};
export const handleUpdateUsername = async (id: string, username: string) => {
  const { data, error } = await supabase
    .from('profiles')
    .update({ username: username })
    .match({ id: id })
    .single();

  if (error) {
    console.log('error', error);
    return error;
  } else {
    console.log('data', data);
    return data;
  }
};
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to export data from an external server to Supabase
SupabaseSSupabase / help-and-questions
5mo ago
How to update data in view
SupabaseSSupabase / help-and-questions
4y ago
how to save data from an other API crud-app
SupabaseSSupabase / help-and-questions
4y ago
Get new data from request
SupabaseSSupabase / help-and-questions
4y ago