Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Why my data get undefined when I successfully get the response?

I don't know why I get undefined when I tried to console.log at my final step in UseEffect

I've successfully gotten the response, the response returns to me with 200 status and data in it.

enter image description here

I designed my database like this

2 tables, animes table contains unique anime_title and auto-increment id.

id  anime_title anime_image anime_url

anime_detail table contains a foreign key that is linked with anime-title in animes table

id anime_title anime_episode anime_url

So in my code, I tried to get anime_title in my animes table in superbase based on the id from the useParams

I've successfully gotten both of them, and successfully use the anime_title to get all the anime_episode based on the anime_title

But when I tried to console.log the last step, it return to me undefined value, which I don't know why.

Here's my code:

import { useState, useEffect } from "react"
import './animedetail.css'
import { useParams } from 'react-router-dom'
import { supabase } from '../../supabaseClient'

function AnimeDetail(){

    let animeID = useParams()

    useEffect(async () => {
        // GET ID
        let id = await animeID.id
        console.log(id)

        // QUERY WITH ID
        const {data, error} = await supabase
        .from('animes')
        .select('id, anime_title, anime_url')
        .match({id: id})

        // GET ANIME TITLE BY ID
        let animeTitle = await data[0].anime_title
        console.log(animeTitle)

        // GET EPISODE BASED ON ANIME TITLE
        const {dataInfo} = await supabase
        .from(`anime_detail`)
        .select(`id, anime_title, anime_url, anime_episode`)
        .filter(`anime_title`, `in`, `(${animeTitle})`)

        console.log(dataInfo)
    }, [animeID])


    return (
        <>
        <div className = "anime-list-section">
        <h2>Anime Detail:</h2>
        <p></p>
        </div>
        </>
    )

}
export default AnimeDetail 
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Based on the documentation of supabase-js (https://supabase.com/docs/reference/javascript/filter) there is no dataInfo in the result of a filter query. Instead its just what you have above that when you executed the first query.

Deconstruct the result like the following to gather your information

// GET EPISODE BASED ON ANIME TITLE
const const {data: dataInfo, error: errorInfo } = await supabase // no dataInfo, but data, error like in the documentation
    .from(`anime_detail`)
    .select(`id, anime_title, anime_url, anime_episode`)
    .filter(`anime_title`, `in`, `(${animeTitle})`)

console.log(dataInfo)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!