-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancing a theme component can only be done once #4530
Comments
Yes, this is a limitation of current theming system. I'm not sure how to solve this problem, but agree it could be nice to be able to enhance a component multiple times in a row. For now the best option is to add all your enhancement logic in a single wrapper, which may lead to copying some existing enhancers code and maintaining it over time. Was wondering, what's your usecase for this? It does not feel like a very common need |
The use case is that I wanted to use both For now I disabled the live codeblock as I can get along without it. |
One possibility is to create a comp like Then you could swizzle |
Hi @slorber , I am facing the same issue . I am using two themes @docusaurus/theme-live-codeblock and @saucelabs/theme-github-codeblock. Although I understand that why onle one theme is used at the runtime and second is overriden. But not able find the solution for it.
|
🐛 Bug Report
If more than one plugin enhances a theme component (https://docusaurus.io/docs/using-themes/#for-plugin-authors), such as
docusaurus-theme-live-codeblock
, subsequent enhancers past the first will receiveundefined
for the imported component to enhance from@theme-init
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
@docusaurus/theme-live-codeblock
packageCodeBlock
):docusaurus start
Expected behavior
You can have more than one theme enhancing a given component (i.e. the second theme instance would enhance the component enhanced by the first instance).
Actual Behavior
Importing the component after one enhancement gives undefined.
Your Environment
Reproducible Demo
CodeSandbox
The text was updated successfully, but these errors were encountered: