hasMore stale after dataUpdated event

I’m retrieving posts from a community and checking for further pages when the results are loaded using the following code.

import { FeedType, PostRepository } from '@amityco/js-sdk'

const communityId = 'XXX'

const results = PostRepository.queryCommunityPosts({
    feedType: FeedType.Published

results.on('dataUpdated', (data) => {
    setTimeout(() => console.log(results.hasMore))

The problem is that the value of hasMore is always stale, and I need to work around this by wrapping the check in a setTimeout to get the correct value.

Given a community with two pages of results, the first load will return false for hasMore and if I call nextPage, the next load will return true.

Am I misunderstanding how to use the results? Or is this a bug?

Hi @matt - we have identified and is able to reproduce the issue. I have provide this bug to the product team and will fix it in the upcoming releases

1 Like

Hello @matt sorry for keeping you waiting, the fix version of this issue will be v4.18.0 which will be released on the 28th of September.