I’m using ts-sdk 6.19.0 and running into this problem:
I’m fetching a post using PostRepository.getPost and I subscribe to its updates. When I add reaction to this post, using ReactionRepository.addReaction, post for some reason gives me undefined when I try to access ‘creator’ field which I use to display user’s avatar and name. Though reaction is added successfully.
This works only when I fetch only one post, when I use PostRepository.getPosts, and render all returned posts and then try to add reactions to some of them, it works fine.
What could be the possible reason of that? Is something wrong with my code or is it a bug?
Here is my useGetPost hook -
Hello @SocialPlus_Support.
Thanks for responding, I’ve checked this section multiple times. I don’t have any problems with post Collection. I have a separate page for each post, on this page I get post id and then I fetch this post using my useGetPost hook which I’ve included above. Then when I try to add reaction to this post, like for example, it returns me updated post object but with creator field undefined which is confusing
@SocialPlus_Support also for some reason I don’t get live updates for the comments of post, I’ve subscribed to a postTopic with SubscriptionLevels.COMMENT, but it doesn’t work. Reaction is added only when I refresh the page, here is my updated useEffect -
@SocialPlus_Support it does work, thanks. But it’s inconvenient to subscribe to all user’s comments when all I need is to subscribe to particular post updates, including comments. Why when I subscribe to post updates using getPostTopic it doesn’t work?
Also, how to type correctly return value from CommentRepository.getComments? In typedef it says that data parameter of callback function supposed to return Amity.InternalComment array, but this type doesn’t include creator field, at the same time there is type Amity.Comment which is more likely to be what the method actually returns, because creator field is present in all comments
@denys_danyliuk We apologize for the inconvenience, and we appreciate your feedback. We will forward your feedback to the relevant team for further product development. Regarding the issue with the ‘creator’ field missing in a post, our team is currently investigating it. We will keep you updated on any progress.
Hello @denys_danyliuk , For the issue with the ‘creator’ field missing in a post, our team has now released a fix in Version v6.21.1. You can check it at this link: Amity TypeScript SDK on npm. Please try again, and if the issue persists, let us know.