diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-11 15:28:08 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-11 15:33:04 +0100 |
| commit | 99014e5634c6216173bf90117750f95172924134 (patch) | |
| tree | a1e53640de7ecc7af4cfe4b29e3c78516504d485 /src/components/ToC/ToC.tsx | |
| parent | 1a74d19cf4ad080e822e84472288c701ce001e60 (diff) | |
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).
Diffstat (limited to 'src/components/ToC/ToC.tsx')
| -rw-r--r-- | src/components/ToC/ToC.tsx | 3 |
1 files changed, 0 insertions, 3 deletions
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 ( <li key={heading.id}> <a href={`#${heading.id}`}>{heading.title}</a> |
