Repository navigation
break(theme-common): remove unused /internal hooks (AI-assisted) - #12764
Merged
Merged
Conversation
…AI-assisted) Added with the flat TOC refactor (#6729), but no theme ever used it: themes use useFilteredAndTreeifiedTOC. Only its own test called it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(AI-assisted) No package or website code imports useTitleFormatter, useLocationChange, useHistoryPopHandler, useScrollController, useSmoothScrollTo or useHistorySelector from @docusaurus/theme-common/internal. The hooks stay: theme-common uses them internally, and useHistorySelector stays public. useScrollController is now only used in scrollUtils.tsx, so it's no longer exported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
This was referenced Oct 23, 2026
…(AI-assisted) Some users likely rely on it to format page titles: it's the hook to use alongside TitleFormatterProvider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
(AI-assisted) Before removing these hooks, we searched this repo's issues, PRs and discussions for each name, to check whether users rely on them:
No one reported importing the removed hooks from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking Changes
(AI-assisted)
Removes unused hooks from
@docusaurus/theme-common/internal. This entry point is internal, with no stability guarantee.useTreeifiedTOC(toc): useuseFilteredAndTreeifiedTOC({toc, minHeadingLevel: 2, maxHeadingLevel: 6}), which returns the same tree.useLocationChange,useHistoryPopHandler,useScrollController,useSmoothScrollTo: copy their code if you need them.Also removes the explicit
/internalre-export ofuseHistorySelector. It's part of the public API: import it from@docusaurus/theme-common. Its/internalimport keeps working through theexport * from './index're-export, so this one is not breaking.useTitleFormatterstays exposed in/internal: some users likely rely on it, together withTitleFormatterProvider.Motivation
Dead code found with a one-off
knip --include-entry-exportsrun: default Knip never reports the exports of package entry points.useTreeifiedTOCwas added in refactor: make MDX export a flat TOC list instead of tree #6729, but no theme ever used it: themes useuseFilteredAndTreeifiedTOC. Only its own test called it.useHistorySelectorre-export, the CI step that removesexport * from './index'(removeThemeInternalReexport) now catches internal code importing it from/internal.useScrollControlleris now only used inscrollUtils.tsx, so it's no longer exported (Knip).Test Plan
packages/andwebsite/(including swizzled components and_dogfooding) withrg -a: nothing imports these hooks from/internal.removeThemeInternalReexport, swizzle tests.Test links
Deploy preview: https://deploy-preview-12764--docusaurus-2.netlify.app/
Related issues/PRs
Split from the dead-code validation PR #12751.
🤖 Generated with Claude Code
Summary by CodeRabbit