orderDescending not needed with SortedMap
This commit is contained in:
parent
cdd814cf73
commit
1fd37a42d2
@ -1,6 +1,7 @@
|
||||
import { useEffect } from "react";
|
||||
import { useInView } from "react-intersection-observer";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import usePageDimensions from "@/Hooks/usePageDimensions";
|
||||
import { debounce } from "@/Utils";
|
||||
|
||||
|
@ -2,7 +2,6 @@ import { useContext } from "react";
|
||||
|
||||
import { useArticles } from "@/Feed/ArticlesFeed";
|
||||
import { DeckContext } from "@/Pages/DeckLayout";
|
||||
import { orderDescending } from "@/Utils";
|
||||
|
||||
import Note from "../Event/EventComponent";
|
||||
|
||||
@ -16,7 +15,7 @@ export default function Articles() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{orderDescending(data).map(a => (
|
||||
{data.map(a => (
|
||||
<Note
|
||||
data={a}
|
||||
key={a.id}
|
||||
|
@ -9,7 +9,6 @@ import PageSpinner from "@/Components/PageSpinner";
|
||||
import { useNotificationsView } from "@/Feed/WorkerRelayView";
|
||||
import useLogin from "@/Hooks/useLogin";
|
||||
import useModeration from "@/Hooks/useModeration";
|
||||
import { orderDescending } from "@/Utils";
|
||||
import { markNotificationsRead } from "@/Utils/Login";
|
||||
|
||||
import { getNotificationContext } from "./getNotificationContext";
|
||||
@ -33,7 +32,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
|
||||
};
|
||||
|
||||
const myNotifications = useMemo(() => {
|
||||
return orderDescending([...notifications]).filter(
|
||||
return notifications.filter(
|
||||
a => !isMuted(a.pubkey) && a.tags.some(b => b[0] === "p" && b[1] === login.publicKey),
|
||||
);
|
||||
}, [notifications, login.publicKey]);
|
||||
|
@ -289,10 +289,6 @@ export const delay = (t: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
export function orderDescending<T>(arr: Array<T & { created_at: number }>) {
|
||||
return arr.sort((a, b) => (b.created_at > a.created_at ? 1 : -1));
|
||||
}
|
||||
|
||||
export function orderAscending<T>(arr: Array<T & { created_at: number }>) {
|
||||
return arr.sort((a, b) => (b.created_at > a.created_at ? -1 : 1));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user