Hi Amity-Team,
I am in the process of migrating a React-native app (0.71) from the ts-sdk 0.0.1 to version 6.2.0.
And I have a problem with the liveCollection returned from PostRepository.
My Code looks like this:
CommunityRepository.getCommunity(config.communityId, community => {
const communityTopic = getCommunityTopic(
community.data,
SubscriptionLevels.POST_AND_COMMENT,
);
const topicUnsub = subscribeTopic(communityTopic, e => {
e && console.error(e);
});
PostRepository.getPosts(
{ targetId: config.communityId, targetType: 'community' },
updatedPosts => {
console.log(JSON.stringify(updatedPosts));
},
);
});
So I am subscribing for post and comment updates and the console.log statement is written everytime I create a Post or add an reaction. So far so good.
In the Log I see:
Subscribed to topic 61..71/social/community/6...f9/post/#
What’s not working is comments. The SubscriptionLevels.POST_AND_COMMENT suggests that it should also work for those right?
When I use CommentRepository.getComments for a single Post it works but I have to create subscriptions for every single post in the community.
Is there something I am doing wrong here? Or whats the correct way to register for new Posts, Comments and Reactions is a community?
Thx