I am trying to implement refreshing with the TS SDK. I am able to query posts as follows, but using PostRepository.getPosts again on refresh does not grab the latest posts. Any ideas for how to do this?
const GetPosts: FC<{ targetId: string; targetType: string }> = ({ targetId, targetType }) => {
const [posts, setPosts] = useState<Amity.Post[]>();
const fetchPosts = () => {
const unsubscribe = PostRepository.getPosts(
{ targetId, targetType },
({ data: posts, onNextPage, hasNextPage, loading, error }) => {
setPosts(posts);
},
);
unsubscribe()
}
useEffect(() => {
fetchPosts();
});
const onRefresh() => {
fetchPosts() // NOT RECEIVING NEW POSTS
}
return null;
};