PaloAltoNetworks / docusaurus-openapi-docs

🦝 OpenAPI plugin for generating API reference docs in Docusaurus v3.
https://docusaurus-openapi.tryingpan.dev
MIT License
723 stars 239 forks source link

Docusarus 3.6.0 upgrade breaks this package #1013

Open Celtech opened 3 weeks ago

Celtech commented 3 weeks ago

Describe the bug

If you upgrade a docusarus site to the 3.6.0 release it will trigger the following error when you do a yarn start

Hook useScrollController is called outside the <ScrollControllerProvider>. 
ReactContextError
    at useScrollController (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-common/lib/utils/scrollUtils.js:27:145)
    at useScrollPositionBlocker (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-common/lib/utils/scrollUtils.js:45:63)
    at TabList (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/lib/theme/MimeTabs/index.js:6:2109)
    at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:15487:18)
    at mountIndeterminateComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20099:13)
    at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21622:16)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4165:14)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4214:16)
    at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4278:31)
    at beginWork$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:27486:7)

Expected behavior

Current behavior

Possible solution

Steps to reproduce

1. 2. 3. 4.

Screenshots

Context

Your Environment

pmarschik commented 3 weeks ago

I've done the upgrade to docusaurus 3.6.0 but I've also upgraded docusaurus-openapi-docs to 4.2.0 in the same change. With 4.2.0 I don't get the error you describe.

In the mentioned PR docusaurus-openapi-docs is still on 4.1.0 so maybe upgrading to 4.2.0 helps?

sschuberth commented 3 weeks ago

In the mentioned PR docusaurus-openapi-docs is still on 4.1.0 so maybe upgrading to 4.2.0 helps?

Do you mean these? If I'm reading the lockfile correctly, both docusaurus-plugin-openapi-docs and docusaurus-theme-openapi-docs are at version 4.2.0 already.

pmarschik commented 3 weeks ago

Yes. Interesting, must be some other issue then since I couldn't reproduce your issue and I'm using docusaurus 3.6.0 + @docusaurus/faster + docusuarus-openapi-docs 4.2.0.

alvinometric commented 3 weeks ago

Also getting the same issue with Hook useScrollController is called outside the <ScrollControllerProvider> when upgrading to Docusaurus 3.6 and version 4.2 of this plugin

sserrata commented 3 weeks ago

Issues like these are almost always due to dependency mismatches, especially between Docusaurus deps. You can try deleting yarn.lock and reinstalling for a quick fix.

alvinometric commented 3 weeks ago

@sserrata Unfortunately this seems to persist even with:

sserrata commented 3 weeks ago

Ah, I just realized you may still be on 4.2.0, which doesn't support Docusaurus 3.6.0. If that's the case, can you upgrade to the latest canary release?

sserrata commented 3 weeks ago

Just read your latest comment...not sure what the issue could be since the demo site is currently on Docusaurus 3.6.0 and I've not been able to repro locally.

ianbaek commented 2 weeks ago

I had the same issue of 'Hook useScrollController is called outside the ' after updating to 4.2.0 at Docusarus 3.5.2. Upgrading Docusarus to 3.6 in my case solved the issue. It might be some dependency issue but could not find exactly what caused the issue.

otuoche commented 2 weeks ago

i am still having the same issue too

ChrisSargent commented 2 weeks ago

yarn dedupe solved it for us

sschuberth commented 2 weeks ago

yarn dedupe solved it for us

Didn't help in our case.

ChrisSargent commented 2 weeks ago

well..... yarn dedupe solved the useScrollController error but not another one that we get just from doing the openapi plugin upgrade so 🤷