fix: resolve the issue of frequent triggering of replaceState

This commit is contained in:
LIlGG
2025-10-10 12:23:42 +08:00
parent 63636fef1f
commit 5b8408d7da
2 changed files with 10 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import type { ServerChatItem } from '~/lib/hooks/useChatEntries';
type Bin = { category: string; items: ServerChatItem[] };
export function binDates(_list: ServerChatItem[]) {
const list = _list.toSorted((a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp));
const list = _list.slice().sort((a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp));
const binLookup: Record<string, Bin> = {};
const bins: Array<Bin> = [];