https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • n

    Nathan

    11/27/2021, 4:01 AM
    How would I add the extra chains dynamically?
  • n

    Nathan

    11/27/2021, 4:05 AM
    For example, I have a list of vehicles, and I want the user to be able to apply multiple filters at once
  • d

    Deleted User

    11/27/2021, 6:43 AM
    Hi Supabase! I'm currently trying to work out auth, and I'm trying to do something like this on sign in:
    Copy code
    js
    const { error } = await supabase.auth.signIn(
      {
        provider: "github",
      },
      {
        redirectTo: `http://localhost:3000${window.location.pathname}${window.location.search}${window.location.hash}`,
      }
    );
    The problem is that it always redirects to my main page I specified in the dashboard's Settings.
    http://localhost:3000
    is whitelisted in my dashboard's settings, however, it only works if it's only
    http://localhost:3000
    and nothing else, such as
    http://localhost:3000/...
    . The only other solution I found is to do
    ?redirect=http://localhost:3000/...
    and handle the redirect myself. However, I found this not ideal as I have my sign in component in my navbar.
    Edit: the "workaround" doesn't actually work. 😦
    s
    • 2
    • 5
  • a

    anothercoder

    11/27/2021, 8:18 AM
    supabase.from('cities').select('name, country_id').gte('population', 1000).lt('population', 10000); or t = supabase.from('cities').select('name, country_id'); t.gte('population', 1000); t.lt('population', 10000);
  • s

    silentworks

    11/27/2021, 4:03 PM
    Redirect to url
  • d

    Deleted User

    11/28/2021, 5:33 AM
    Also one more thing, is there a way to delete the logged in user's account on the client side? I found
    deleteUser()
    but that need to be done on the server.
  • k

    Khan W

    11/28/2021, 7:26 AM
    Best way to do that is to probably create a function and call it server side. Make sure that you verify that the user should be allowed to delete the user. The auth table, for good reason, isn’t editable by client side code so a function is the best way to do that.
  • h

    harshcut

    11/28/2021, 1:29 PM
    Has anyone found an answer for this discussion for Next.js? I have a
    /login
    and a
    /u/overview
    route. When the user logs in from
    /login
    , it triggers a redirect before the cookie is set. - https://github.com/supabase/supabase/discussions/2842 My github repository - https://github.com/harshcut/ultimo-pase/tree/main/pages
  • n

    Nathan

    11/29/2021, 8:24 PM
    Calling these methods (gte, lt) on
    t
    is not possible. (throws error) For better context, what I am trying to do is use my URL params to create a select query. For example,
    /inventory?make=Nissan&model=Maxima&year=2018,2021
    . I'm currently passing my URL params as an object into
    match()
    . This works perfectly until I have a range in the params, such as
    year=2018,2021
    . This will not work. Obviously I need to use the filter methods for the ranges. And this here lies the problem .. or inconvenience. I'm going to have to write multiple IF statements for each possible combination of ranges. (
    year
    ,
    price
    , &
    miles
    ). Thoughts on possibilities? Thanks!
    g
    a
    • 3
    • 35
  • m

    mikk

    11/30/2021, 7:50 AM
    Hi, couldn't any docs on this – is it possible to perform two queries with one request? Something like a sub-query? Eg. "*" by ID + "slug, name, thumbnail" of with the same "type" as the initial query
  • m

    mikk

    11/30/2021, 7:51 AM
    Without using multiple requests
  • c

    chipilov

    11/30/2021, 9:57 AM
    Not sure if this is possible to do against the original tables, but you can definitely do it either with (a) a custom view which you query from the js client just like a regular table or (b) with a Postres function which you can call from the js client using the rpc() method
  • m

    mikk

    11/30/2021, 10:05 AM
    Thanks @User for pointing me in the right direction. Solved it with creating a postgres function in the sql interface. And calling it
    supabase.rpc('get_templates', { slug_input: slug }).select('title, slug, thumbnail_url')
    in parallel with the original query with Promise.all
  • c

    chipilov

    11/30/2021, 10:56 AM
    I thought you wanted to get everything with a single request? Why not create a Postgres function which returns everything?
  • l

    laznic

    11/30/2021, 4:50 PM
    Probably know the answer to this however is it possible to do an
    .eq
    check using a value from the query? So for example, if I'd want to filter some relationships out of based on
    table.col_x
    value, is it possible or do I have to do a view/procedure to do this?
    Copy code
    supabase.from('table').select(`...`).eq('relation.inner.col_y', 'table.col_x')
  • e

    egnus

    11/30/2021, 5:51 PM
    @User I would say no, I believe supabase client has still a lot to grow. Specially when talking about aggregated data, nested data, recursive data or hoisted data.
  • m

    Mihai

    12/02/2021, 10:00 AM
    Hello ! Is there a document which I can follow some tips If I'm ready to go into production with supabase? I'm using NextJS as tool.
  • l

    laznic

    12/02/2021, 10:52 AM
    https://supabase.com/docs/going-into-prod
  • n

    Null

    12/02/2021, 6:22 PM
    Is this the right way to set up a column containing an array? When I fetch my data it comes up as empty when it clearly has value
  • n

    Null

    12/02/2021, 6:25 PM
    Idk if Supabase updated something because this never has happened before.
  • l

    leynier

    12/02/2021, 7:22 PM
    I'm having trouble running the gotrue-js tests, apparently it was an update to the docker images, does anyone know about it? I am testing it on the last commit of the main branch.
  • f

    FreakDJ

    12/03/2021, 1:29 AM
    Hi all! Could someone help me set up my query to pull the data that I would need? The table has the columns [id, timestamp, name, price, volume]. Every hour, new data populates into the table with updated price/volume for a given name. I want to automate this data to display on the front end, but for this given page, I just need to display the name, the most recently recorded price and the second most recent price based on timestamp. Is there a nice way to set a query up to grab this data, or will it be a bit more processing (ie, get all the data and manually sort through it with JS)?
  • a

    anothercoder

    12/03/2021, 1:37 AM
    https://supabase.com/docs/reference/javascript/order
  • f

    FreakDJ

    12/03/2021, 1:46 AM
    So I can order by timestamp, but is there a way to just pull in the latest two timetamps? The table has a lot of data and I can see it taking a long time to loop through it in Javascript to organize it by name and prices if that makes sense
    g
    a
    t
    • 4
    • 44
  • a

    anothercoder

    12/03/2021, 1:51 AM
    If u use order() so that the latest is at the start, u can pick the 1st two records returned.
  • g

    garyaustin

    12/03/2021, 1:52 AM
    .limit(2) edit. may have misread you don't want 1 item's last 2 but all items last 2
  • k

    KailiKameoka

    12/04/2021, 12:56 AM
    I don’t understand how to use the real-time subscription in react. I copied the examples from the docks into a function that gets called in useEffect. It direct seen to be using the callback.
    j
    • 2
    • 1
  • b

    Bazze

    12/05/2021, 7:01 AM
    Im having a hard time finding any sources on authenticating in React Native with a 3rd party provider. Anything i try, i just keep on getting errors. Anyone have any pointers?
  • e

    egnus

    12/05/2021, 9:41 AM
    I think I found a bug with the new
    !inner
    feature for joining tables. Given 2 tables,
    Users
    and
    Roles
    for instance. If I activate
    count
    and filter by a Correct filter of User_id but *an Inexistent Incorrect role inner filter * the count will return
    1
    but with no data in the array.
    Copy code
    javascript
    const {data, error, count} = await supabase.from('users')
     .select('*, role:roles!inner(*)', {count: 'exact'})
     .eq('user_id', 123) // This is a matching correct user
     .eq('role.name', 'whatever') // This will never be true.
    data.length === 0 // true
    count === 0 // false (This should be true)
    count === 1 // true (This should be false)
    I need confirmation but I think this is a bug
  • e

    Eduardo Lopez

    12/06/2021, 12:14 AM
    With firebase firestore I am used to the library handling the tab being idle so that when the user comes back, realtime info gets fetched and updated automatically. This doesn't happen with supabase-js Does anyone knows if there is just something I am missing like a setting? Or I just need to wait for supabase-js to be improved over time, as it still is in beta
    g
    s
    • 3
    • 4
1...343536...81Latest