docusaurus-openapi-docs
docusaurus-openapi-docs copied to clipboard
Adding second API reference to sidebar results in Hook usedoc error
Describe the bug
When I add a second API reference to my site it results in a "Hook useDocsVersion is called outside the <DocsVersionProvider>.
Expected behavior
Both API references should be on the sidebar.
Current behavior
The files generate from the spec but the moment I add a second API ref to my sidebars.ts the site breaks. When I comment one API ref out of sidebars.ts the error stops and the site works again. Each API reference works individually, just not together.
Possible solution
I'm assuming this is a compatibility issue with Docusaurus 3. I've tried every combination of Docusaurus 3.0.0 and after with every combination of the plugin beta 3.0.0.-beta1 and after and I've gotten the same result every time.
Steps to reproduce
- Use a second spec and generate the files in another directory
- Add the second API reference to the sidebar file
- Site crashes
Screenshots
If I comment one API ref out, then the site works. This is true regardless of which API ref I comment out.
Context
Need two distinct API references on the same sidebar.
Your Environment
- Version used: Docusaurus
3.0.0and docusaurus-plugin-openapi-docs3.0.0-beta.1; also tried with the latest Docusaurus and the latest plugin beta and get same results - Environment name and version:
- Operating System and version: macOS 14.3
- Link to your project: not yet public
Hi @cdstull, thanks for opening the issue. Given the information provided I'm not sure what the issue could be. FWIW, we currently build/deploy a Docusaurus v3 site and plugin with multiple specs referenced in a single sidebar:
Preview: https://docusaurus-openapi-36b86--pr660-knd150qi.web.app/category/petstore-api PR: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/pull/660
Same issue here when using the beta.10 version along with core 3.1.1 and using a 2nd docs plugin to host the apis.
This error is typically associated with mismatched docusaurus dependency versions. I recommend triple checking to ensure all dep versions are in alignment and reinstalling deps after cleaning node_modules and lock file.