How to get list of posts under a community?

Is there way to get list of posts from a community?

We have few posts created under a community but we do not see any SDK exposed to retrieve these posts.

Is there a recommended way of getting posts for a community?

Hello @sijanshs !

Could you please let me know the package name and version you’re using?

It seems most likely that the function doesn’t show up (and i would like to investigate why), but according to our latest source code, the PostRepository should have methods:


exposed for you.

Please let me know the package you’re using and if that worked for you.

Thanks for the quick reply, Here is the package detail
"eko-sdk": "^4.5.1"

I found this is exposed in @amityco/js-sdk.

Are there any breaking changes if we just switch to this SDK ?

Could you share some documentaion on how to paginate for the

I tried the @amityco/js-sdk and I am able to fetch the posts for the community but not sure how to paginate.

i tried the following way but is not working, any suggestion is much appreciated
communityPostsRef.current = PostRepository.queryCommunityPosts({ communityId, last: 1 });

There should be few changes which could be breaking in mainly term of naming of imports ; otherwise there will be no breaking changes in logic. The official guide for migration is here: Web SDK v5.0.0 Migration Guide - Amity Docs for which you can check if you have some breaking change.

I’ll get back to you soon with a working example for community posts with pagination :slight_smile:

1 Like

Hello @sijanshs !

For the pagination you can refer to our documentation on LiveCollection which you will find here: Live Objects - Amity Docs

As i can see you’re working with react hooks, so if you need extra help for integration let me know.

Yes, it would be helpful for examples with hooks.

Currently, I found the data updated is not getting triggered once I navigate back and forth between component. An example might definitely help on this.

I’ve build a small example with loading a list of channels with infinite scroll and pagination. You will find what you need concerning the pagination logic in the ChannelList component.

Let me know if you have further questions.

1 Like