PostRepository.queryAllPosts not returning more than 20 posts

Hi, I’m trying to build a paginated feed of all my posts. In the Amity console, I can see that I have 26 posts. However, I can’t get the query to return more than 20 ever:

const globalFeed = PostRepository.queryAllPosts({limit: 30});

    globalFeed.on('dataUpdated', (posts) => {
      console.log('All posts', posts);
      setData(posts)
    });

I’m using the "@amityco/js-sdk": "^5.35.3".

Even with the limit set to 30, I still get only 20 posts. Additionally, globalFeed.hasMore is returning false, and calling globalFeed.nextPage() manually via button press doesn’t return any additional posts.

How can I query all my posts?

For reference, here’s my entire feed component:

export default function Feed() {

  const [data, setData] = useState([])
  const [globalFeed, setGlobalFeed] = useState()

  // setup global feed initially
  useEffect(() => {
    const globalFeed = PostRepository.queryAllPosts({limit: 30});

    globalFeed.on('dataUpdated', (posts) => {
      console.log('All posts', posts);
      setData(posts)
    });
    setGlobalFeed(globalFeed)
  }, [])

  console.log(data)
  const loading = globalFeed?.loadingStatus === LoadingStatus.Loading

  return (
    <InfiniteScroll
      dataLength={data.length}
      next={() => { globalFeed?.nextPage(); console.log("calling next page") }}
      hasMore={globalFeed?.hasMore ?? true}
      height={window.innerHeight - 80} // lil hack to enable pagination
    >
      {!loading && data.map((post) => (
        <div key={post.postId}>
          <FeedItem post={post}  />
        </div>
      ))}
      <Button onClick={() => globalFeed?.nextPage()}> Load More </Button>
    </InfiniteScroll>
  )
}

Note @amitysupport this also repros in your example code sandbox link – Amity only ever loads 20 posts:

[ui-kit-app - CodeSandbox](Code sandbox link) I used this example and then plugged in my own API key and userid. The newsfeed is still only showing 20 posts and there is no ‘Load More’ option.

Is there a recent bug on the queryAllPosts that limits posts to only 20 ever? Or is there a setting that I’m missing that would cap my returns at 20? Because I can get all my posts if I click into a community.

Hello @ncc please see how to implement pagination and sample code here: https://docs.amity.co/core-concepts/live-objects-collections/Js#pagination