Fix space children without specific order being sorted after those with one

This commit is contained in:
Michael Telatynski 2021-09-28 15:37:57 +01:00
parent e95e59e2eb
commit d7c43c7cf8

View file

@ -93,7 +93,7 @@ const validOrder = (order: string): string | undefined => {
// For sorting space children using a validated `order`, `m.room.create`'s `origin_server_ts`, `room_id` // For sorting space children using a validated `order`, `m.room.create`'s `origin_server_ts`, `room_id`
export const getChildOrder = (order: string, creationTs: number, roomId: string): Array<Many<ListIteratee<any>>> => { export const getChildOrder = (order: string, creationTs: number, roomId: string): Array<Many<ListIteratee<any>>> => {
return [validOrder(order), creationTs, roomId]; return [validOrder(order) ?? NaN, creationTs, roomId]; // NaN has lodash sort it at the end in asc
}; };
const getRoomFn: FetchRoomFn = (room: Room) => { const getRoomFn: FetchRoomFn = (room: Room) => {