Inconsistent data while fetching user post

Hey,
I am trying to fetch the user post using the below code.

PostRepository.queryPosts({
         targetType: "user",
        targetId: process.env.REACT_APP_AMITY_USER_ID,
        sortBy: "lastCreated",
        includeDeletedPosts: false,
        includeChildrenPosts: false,
        matchingOnlyParentPost: true,
        limit: 15,
})

The above code is working fine, I am getting all the data (500+ posts) active present in DB and the pagination also working as expected.

But when I change the params includeDeletedPosts to true then I am getting only 16 posts (active and deleted) of the user out of 500+. Pagination also not working for the above filter.

Please let me know If I am doing anything wrong here.

Hi @Ashish thanks for reaching out, we will look into this.

Hello, we are unable to reproduce this problem on our side. Could you please review the sample code provided below and comparing it to your current code:

let userPostCollection;
  function queryUserfeed() {
    const liveCollection = PostRepository.queryPosts({
      targetType: 'user',
      targetId: 'John',
      sortBy: 'lastCreated',
      limit: 15,
      includeDeletedPosts: true,
      includeChildrenPosts: false,
      matchingOnlyParentPost: true,
    });

    userPostCollection = liveCollection
    liveCollection.on('dataUpdated', models => {
      console.log('user posts:', models);
    });
  }
  function queryUserfeedNext() {
    if (userPostCollection && userPostCollection.loadingStatus === "loaded" && userPostCollection.hasMore) {
      console.log('userPostCollection: ', userPostCollection);
      userPostCollection.nextPage();
    }

  }

Hey,
This code looks similar, don’t know why I am facing this issue. I am changing only one key includeDeletedPosts rest everything is the same.

Could you please explain what the below parameters do?

     includeChildrenPosts: false,
     matchingOnlyParentPost: true,
  • includeChildrenPosts: In this context, “ChildrenPosts” refer to elements such as images, videos, polls, and livestreams within the post.

  • matchingOnlyParentPost: When set to true, it will filter only parent posts.

API for reference: Amity API