Skip to content

Commit

Permalink
regression: Sidepanel sort requires refresh after room update (#33370)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Sep 26, 2024
1 parent 7259970 commit 14f7fd1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { IRoom } from '@rocket.chat/core-typings';
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import type { Mongo } from 'meteor/mongo';
import { useEffect, useMemo } from 'react';

import { ChatRoom } from '../../../../../app/models/client';
Expand All @@ -12,7 +13,7 @@ const sortRoomByLastMessage = (a: IRoom, b: IRoom) => {
if (!b.lm) {
return -1;
}
return new Date(b.lm).toUTCString().localeCompare(new Date(a.lm).toUTCString());
return b.lm.getTime() - a.lm.getTime();
};

export const useTeamsListChildrenUpdate = (
Expand All @@ -23,7 +24,7 @@ export const useTeamsListChildrenUpdate = (
const queryClient = useQueryClient();

const query = useMemo(() => {
const query: Parameters<typeof ChatRoom.find>[0] = {
const query: Mongo.Selector<IRoom> = {
$or: [
{
_id: parentRid,
Expand Down

0 comments on commit 14f7fd1

Please sign in to comment.