Im trying to get all the comments of the posts, im using the after and before things of the cursor in Facebook graph, but it does not give me all comments.
const fetchAllPostComments = async (postId: string, after: string | null = null, limit: number = 25): Promise<any[]> => { const pageQuery = after ? `&after=${after}&limit=${limit}` : `&limit=${limit}`; const response = await fetch(`${GRAPH_API_URL}/${postId}/comments?access_token=${PAGE_ACCESS_TOKEN}${pageQuery}`); const data = await response.json(); let allComments = data.data || []; if (data.paging && data.paging.cursors && data.paging.cursors.after) { const nextComments = await fetchAllPostComments(postId, data.paging.cursors.after, limit); allComments = allComments.concat(nextComments); } console.log(allComments); return allComments; };