Skip to content

fix: hide TOC panel when buildToc has no headings#360

Merged
tomasz-tomczyk merged 1 commit intomainfrom
fix-empty-toc-render
Apr 25, 2026
Merged

fix: hide TOC panel when buildToc has no headings#360
tomasz-tomczyk merged 1 commit intomainfrom
fix-empty-toc-render

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

  • Defensive parity fix matching fix: hide TOC button and panel when document has no headings crit-web#113.
  • hideToc() only hid the toggle button. If the panel had been opened from a previous render where headings existed (or via cookie restore), a subsequent buildToc() call with no headings would leave the panel visible but empty.
  • Now hideToc() also adds toc-hidden to the panel.

Test plan

🤖 Generated with Claude Code

`hideToc()` only hid the toggle button, leaving the TOC panel visible if
it was already open from a previous render with headings. Now `hideToc()`
also adds `toc-hidden` to the panel so re-renders without headings (e.g.
after round-complete on a file whose headings were removed) close the
panel as well as the button.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@fd41890). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #360   +/-   ##
=======================================
  Coverage        ?   60.97%           
=======================================
  Files           ?       18           
  Lines           ?     7807           
  Branches        ?        0           
=======================================
  Hits            ?     4760           
  Misses          ?     2619           
  Partials        ?      428           
Flag Coverage Δ
e2e 34.89% <ø> (?)
unit 54.78% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk tomasz-tomczyk merged commit 4256ad4 into main Apr 25, 2026
6 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix-empty-toc-render branch April 25, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants