SDK: @amityco/ts-sdk version 7.8.6
Problem: The global feed API is returning posts sorted by engagement level rather than chronological order, making it impossible to display ‘Most Recent’ posts.
Expected Behavior: Posts should be returned in chronological order (newest first)
Additional Info: A coworker said that beta is turned on for our account, but I can’t verify.
What I’ve Tested:
-
createQuery + runQuery() post
-
FeedRepository.getGlobalFeed()
-
FeedRepository.queryGlobalFeed() (in order version of the sdk)
// Chronological using createQuery
const fetchWithCreateQuery = async () => {
isLoading.value = true
error.value = null
try {
const query = createQuery(FeedRepository.queryGlobalFeed)
await runQuery(query, ({ data: postsData, ...options }) => {
posts.value = (postsData as Amity.Post[]) || []
})
return { posts: posts.value, paging: { next: nextToken.value } }
} catch (err) {
error.value = `Error fetching feed with createQuery: ${err}`
throw err
} finally {
isLoading.value = false
}
}
// Chronological using getGlobalFeed
const getChronologicalFeed = async () => {
if (!amity.isConnected()) {
error.value = 'Not connected to Amity'
return { posts: [], paging: { next: null } }
}
try {
return new Promise((resolve, reject) => {
let hasInitiallyResolved = false
FeedRepository.getGlobalFeed(
{}, // No dataTypes filter to get text-only posts
({ data: newPosts, hasNextPage, error: liveError, loading }) => {
if (liveError) {
if (!hasInitiallyResolved) {
reject(new Error(`Error fetching text-only feed (live): ${liveError}`))
}
return
}
if (newPosts && !loading) {
posts.value = newPosts || []
hasMore.value = !!hasNextPage
nextToken.value = null // Live collections don't use tokens
if (!hasInitiallyResolved) {
hasInitiallyResolved = true
resolve({ posts: newPosts || [], paging: { next: null } })
}
}
}
)
})
} catch (err) {
throw err
}
}
//results (mapped to relevant fields)
[
{
"createdAt": "2025-09-04T15:33:53.419Z",
"editedAt": "2025-09-05T14:30:26.299Z",
"commentsCount": 4,
"reactionsCount": 1,
"sharedCount": 0
},
{
"createdAt": "2025-09-05T14:29:24.529Z",
"editedAt": "2025-09-05T14:30:08.749Z",
"commentsCount": 1,
"reactionsCount": 1,
"sharedCount": 0
},
{
"createdAt": "2025-09-04T20:27:53.551Z",
"editedAt": "2025-09-04T20:28:55.361Z",
"commentsCount": 1,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-09-03T19:27:52.563Z",
"editedAt": "2025-09-03T19:27:52.563Z",
"commentsCount": 2,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-09-05T14:30:46.337Z",
"editedAt": "2025-09-05T14:30:46.337Z",
"commentsCount": 0,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-09-05T14:29:04.442Z",
"editedAt": "2025-09-05T14:29:04.442Z",
"commentsCount": 0,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-09-05T13:29:20.823Z",
"editedAt": "2025-09-05T13:29:20.823Z",
"commentsCount": 0,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-08-28T18:07:31.172Z",
"editedAt": "2025-08-28T18:31:38.807Z",
"commentsCount": 2,
"reactionsCount": 1,
"sharedCount": 0
},
{
"createdAt": "2025-09-04T20:29:48.679Z",
"editedAt": "2025-09-04T20:30:00.909Z",
"commentsCount": 0,
"reactionsCount": 0,
"sharedCount": 0
},
{
"createdAt": "2025-09-04T18:09:15.114Z",
"editedAt": "2025-09-04T18:09:15.114Z",
"commentsCount": 0,
"reactionsCount": 0,
"sharedCount": 0
}
]