[ts-sdk] PostRepository - sortBy

Hi Amity team,

I am in the progress of migrating an App from ts-sdk 0.0.1 to 6.4.5

Previously I displayed Posts in our Feed sorted by last comment.

I used query args with sortBy: ‘lastUpdated’

	const queryArgs = {
		targetType: 'community',
		sortBy: 'lastUpdated',

for 6.X I have replaced this code with


But Amity.PostLiveCollection does not accept this sorting option anymore.
Your code is commented with

// Omit sortBy explained in asc-3398

I can’t read your tickets, but are you planning to reintroduce this option in the future? Or what is the current suggested way to sort posts by latest commented?

With kind regards

Please refer to this section, it’s for version 6.x.x: Query Post - Amity Docs

sortBy still available in version 6+

sortBy?: 'lastCreated' | 'firstCreated' | 'lastUpdated' | 'firstUpdated';

It seems like the documentation does not match the code:

in 6.4.5 PostRepository.getPosts(…) accepts Amity.PostLiveCollection

This is taken from your src/domains/posts.ts

 type QueryPosts = {
      targetId: string;
      targetType: Amity.Post['targetType'];
      sortBy?: 'lastCreated' | 'firstCreated' | 'lastUpdated' | 'firstUpdated';
      dataTypes?: Exclude<Amity.PostContentType, 'text'>[];
      includeDeleted?: boolean;
      hasFlag?: boolean;
      feedType?: 'reviewing' | 'published';
      tags?: Amity.Taggable['tags'];
      matchingOnlyParentPost?: boolean;
      page?: Amity.PageRaw;

    // Omit sortBy explained in asc-3398
    type PostLiveCollection = Amity.LiveCollectionParams<
      Omit<QueryPosts, 'sortBy' | 'page'> & {
        sortBy?: 'lastCreated' | 'firstCreated';


sortBy: 'lastUpdated',

results in

TS2322: Type '"lastUpdated"' is not assignable to type '"lastCreated" | "firstCreated" | undefined'.


So I see the docs have been updated:

and the ‘lastUpdated’ option has been removed.

This now matches the code. I’d still like to know if you are planning on reintroducing this, if there is another way to sort posts by latest comments or if I need to figure out something else?

Hello, we have double-checked with our team, and we can confirm that the lastUpdated is no longer available in our current version and at the moment, we don’t have plan to reintroduce it in the future. Apologies for the inconvenience.

hm ok, thx for the answer. But that’s not really what I was hoping for :smiling_face_with_tear: