Skip to content

refactor: move @theme/hooks to @docusaurus/theme-common - #6289

Merged
slorber merged 6 commits into
mainfrom
slorber/move-hooks-to-theme-common
Jan 7, 2022
Merged

refactor: move @theme/hooks to @docusaurus/theme-common#6289
slorber merged 6 commits into
mainfrom
slorber/move-hooks-to-theme-common

Conversation

@slorber

@slorber slorber commented Jan 7, 2022

Copy link
Copy Markdown
Collaborator

Breaking changes

  • All @theme/hooks/* have been moved to @docusaurus/theme-common named exports (sometimes renamed/refactored a bit but it's normally not public API surface)
  • One documented API surface refactored: import useThemeContext from '@theme/hooks/useThemeContext' => import {useColorMode} from '@docusaurus/theme-common';

Motivation

We'd like to keep the @theme namespace mostly for styled UI React components that you can swizzle

All the "UI agnostic" React and JS code is progressively moved to @docusaurus/theme-common

Also do various refactors/renamings and grouping related things together (context value hook, context, context consumer hook)

Have you read the Contributing Guidelines on pull requests?

(Write your answer here.)

Test Plan

refactor: same behavior as before and tests are passing

@slorber slorber added pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: maintenance This PR does not produce any behavior differences to end users when upgrading. labels Jan 7, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 7, 2022
@netlify

netlify Bot commented Jan 7, 2022

Copy link
Copy Markdown

✔️ [V2]

🔨 Explore the source changes: 12f4d22

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61d87ef63199db00075a45e8

😎 Browse the preview: https://deploy-preview-6289--docusaurus-2.netlify.app

@github-actions

github-actions Bot commented Jan 7, 2022

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 87
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-6289--docusaurus-2.netlify.app/

@github-actions

github-actions Bot commented Jan 7, 2022

Copy link
Copy Markdown

Size Change: +998 B (0%)

Total Size: 676 kB

Filename Size Change
website/build/assets/js/main.********.js 502 kB +998 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 41.6 kB
website/build/assets/css/styles.********.css 102 kB
website/build/index.html 29.6 kB

compressed-size-action

@slorber

slorber commented Jan 28, 2022

Copy link
Copy Markdown
Collaborator Author

This change is causing some issues in our plugin ecosystem

I'm thinking we could provide a compatibility layer (webpack or js aliases) temporarily? 🤷‍♂️

@Josh-Cena

Copy link
Copy Markdown
Collaborator

I think it's fine... We are going to break them some time in the future anyways...

antoniancu pushed a commit to Unity-Technologies/com.unity.multiplayer.docs that referenced this pull request Mar 3, 2023
Per facebook/docusaurus#6289,
@theme/hooks moved to @docusaurus/theme-common
antoniancu pushed a commit to Unity-Technologies/com.unity.multiplayer.docs that referenced this pull request Mar 8, 2023
Per facebook/docusaurus#6289,
@theme/hooks moved to @docusaurus/theme-common
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: breaking change Existing sites may not build successfully in the new version. Description contains more details. pr: maintenance This PR does not produce any behavior differences to end users when upgrading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants