Using Select, eq, and range in JS Client iterating over ALL items not filtered?

We're trying to retrieve data from our DB via the supabase JS client, we're filtering out data via the eq and use range to paginate until we no longer receive data.

However, this is giving us a LOT of duplicates. I've tried chaining range then eq and eq then range and both give us thousands of duplicates.

Any ideas what would be causing this/how to do it better ❓
I took a look at the docs and I don't think we missed anything obvious.
I'm suspicious that it has to do with how Postgres doing things but I can't remember the keywords to look for that

Here's a snippet of the code we're using to retrieve map markers from our DB.

      let markerList: Array<any> = [];
      let cursor = SUPABASE_MAX_ROWS;
      let data;
      let index = 0;


      do {
        data = await supabase
          .from('markers')
          .select('markers')
          .eq('markers->>Cluster Label', cluster)
          .eq('version', version)
          .eq('status', algorithm)
          .range(index, cursor);

        index = cursor + 1;
        cursor += SUPABASE_MAX_ROWS;
        markerList = markerList.concat(data.data);
      } while (data.body?.length);
Was this page helpful?