diff --git a/src/public/app/widgets/toc.ts b/src/public/app/widgets/toc.ts index e65b807c1..20fdde57e 100644 --- a/src/public/app/widgets/toc.ts +++ b/src/public/app/widgets/toc.ts @@ -132,10 +132,9 @@ export default class TocWidget extends RightPanelWidget { } } + this.$toc.empty(); if ($toc) { this.$toc.append($toc); - } else { - this.$toc.empty(); } if (["", "show"].includes(tocLabel?.value ?? "") || headingCount >= (options.getInt("minTocHeadings") ?? 0)) {