From 99014e5634c6216173bf90117750f95172924134 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 11 Jan 2022 15:28:08 +0100 Subject: fix(toc): render on each route change and exclude aside titles On subject pages for example, the table of contents was not updated on route change. So I added router.asPath as dependency of useEffect. I also changed the query to exclude all titles in aside (ToC, widgets). --- src/components/ToC/ToC.tsx | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/components/ToC') diff --git a/src/components/ToC/ToC.tsx b/src/components/ToC/ToC.tsx index 3ab482c..b172b3a 100644 --- a/src/components/ToC/ToC.tsx +++ b/src/components/ToC/ToC.tsx @@ -1,6 +1,5 @@ import { t } from '@lingui/macro'; import { Heading } from '@ts/types/app'; -import { slugify } from '@utils/helpers/slugify'; import useHeadingsTree from '@utils/hooks/useHeadingsTree'; import styles from './ToC.module.scss'; @@ -10,8 +9,6 @@ const ToC = () => { const getItems = (headings: Heading[]) => { return headings.map((heading) => { - if (heading.id === slugify(title)) return; - return (
  • {heading.title} -- cgit v1.2.3