refactor: no need to sort

This commit is contained in:
Alejandro Gomez
2023-07-06 23:38:13 +02:00
parent 986b44b7b6
commit ac0940d53a

View File

@ -28,12 +28,5 @@ export function useZapGoal(host: string, link: NostrLink, leaveOpen = false) {
sub
);
const sorted = useMemo(() => {
const s = (data ? [...data] : []).sort(
(a: NostrEvent, b: NostrEvent) => b.created_at - a.created_at
);
return s;
}, [data]);
return sorted.at(0);
return data?.at(0);
}