Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: Sidepanel sort requires refresh after room update #33370

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading