js icon indicating copy to clipboard operation
js copied to clipboard

Marketplace: Active listings query filtering works incorrect

Open UladzislauVintsarevich opened this issue 3 years ago • 0 comments

Hi! I'm using ThirdWeb React SDK to communicate with marketplace contracts.

Active Listings pagination seems to work based on All Listing pagination and just filter data when it's fetched.

Let me show you

I have a ThirdWeb Marketplace Contract with 17 active listings. You can check it by link https://thirdweb.com/mumbai/0xe844E4183DB6F6F026d44a7Cb3AD0C485d18748a/listings

I wrote such code:

const activeListings = await contract.getActiveListings({
    start: 0,
    count: 24,
  });

  const activeListingsSecond = await contract.getActiveListings({
    start: 23,
    count: 24,
  });

  const allListings = await contract.getAllListings({
    start: 0,
    count: 24,
  });
  const allListingsSecond = await contract.getAllListings({
    start: 23,
    count: 24,
  });

  console.log('activeListings', activeListings);
  console.log('activeListingsSecond', activeListingsSecond);
  console.log('allListings', allListings);
  console.log('allListingsSecond', allListingsSecond);

And I have such output: image image

As you can see, I have 17 Active Listings in total. But these listings are placed on different pages, event size of page 24.

I think the issue is that your pagination works based on all listings and data is filtered after fetch.

Could you check it?

Thanks! Have a nice day!

UladzislauVintsarevich avatar Nov 17 '22 05:11 UladzislauVintsarevich