From b687bd9893a6bb663be7a773cb42360f601a082c Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Wed, 22 Mar 2023 11:02:56 +0700 Subject: [PATCH] updated --- next.config.js | 3 --- src/components/note/index.tsx | 11 ++++++++++- src/pages/newsfeed/{thread/index.tsx => [id].tsx} | 5 ++--- 3 files changed, 12 insertions(+), 7 deletions(-) rename src/pages/newsfeed/{thread/index.tsx => [id].tsx} (97%) diff --git a/next.config.js b/next.config.js index 3bd71dbc..07e914ab 100644 --- a/next.config.js +++ b/next.config.js @@ -9,9 +9,6 @@ module.exports = removeImports({ typescript: { ignoreBuildErrors: true, }, - experimental: { - scrollRestoration: true, - }, webpack: (config) => { config.experiments = { ...config.experiments, topLevelAwait: true }; return config; diff --git a/src/components/note/index.tsx b/src/components/note/index.tsx index 5d5909cb..ac10e4ca 100644 --- a/src/components/note/index.tsx +++ b/src/components/note/index.tsx @@ -2,9 +2,11 @@ import { Content } from '@components/note/content'; import { RootNote } from '@components/note/root'; import destr from 'destr'; +import { useRouter } from 'next/router'; import { memo, useMemo } from 'react'; export const Note = memo(function Note({ event }: { event: any }) { + const router = useRouter(); const tags = destr(event.tags); const fetchRootEvent = useMemo(() => { @@ -24,8 +26,15 @@ export const Note = memo(function Note({ event }: { event: any }) { } }, [tags]); + const openThread = () => { + router.push(`/newsfeed/${event.id}`); + }; + return ( -