optimized loading feed content

This commit is contained in:
Ren Amamiya
2023-02-23 12:52:25 +07:00
parent 5210aa2fb8
commit fd66fde0e0
6 changed files with 33 additions and 48 deletions

View File

@@ -2,20 +2,11 @@
import Reaction from '@components/note/atoms/reaction';
import Reply from '@components/note/atoms/reply';
import { User } from '@components/note/atoms/user';
import Content from '@components/note/content';
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
import { memo } from 'react';
const DynamicContent = dynamic(() => import('@components/note/content'), {
ssr: false,
loading: () => (
<>
<p>Loading...</p>
</>
),
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Single = memo(function Single({ event }: { event: any }) {
const router = useRouter();
@@ -32,7 +23,7 @@ export const Single = memo(function Single({ event }: { event: any }) {
<User pubkey={event.pubkey} time={event.created_at} />
<div className="-mt-4 pl-[60px]">
<div className="flex flex-col gap-6">
<DynamicContent data={event.content} />
<Content data={event.content} />
<div className="relative z-10 -ml-1 flex items-center gap-8">
<Reply eventID={event.id} />
<Reaction eventID={event.id} eventPubkey={event.pubkey} />