From 6f69aaf2360a673d7f55e7a4be91b194157646a8 Mon Sep 17 00:00:00 2001 From: DrMint Date: Thu, 5 May 2022 23:41:24 +0200 Subject: [PATCH] Fixed bug when switching between content pages not changing the content --- src/pages/contents/[slug]/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/contents/[slug]/index.tsx b/src/pages/contents/[slug]/index.tsx index d159032..1198b6d 100644 --- a/src/pages/contents/[slug]/index.tsx +++ b/src/pages/contents/[slug]/index.tsx @@ -84,16 +84,15 @@ export default function Content(props: Props): JSX.Element { textSetLocales ) ); - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [appLayout.preferredLanguages]); useEffect(() => { - if (selectedTextSetIndex !== undefined) + if (selectedTextSetIndex !== undefined) { setSelectedTextSet(content?.text_set?.[selectedTextSetIndex]); - if (selectedTextSetIndex !== undefined) setSelectedTitle(content?.titles?.[selectedTextSetIndex]); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectedTextSetIndex]); + } + }, [content?.text_set, content?.titles, selectedTextSetIndex]); const subPanel = (