swagger-ui
swagger-ui copied to clipboard
swagger-ui-react - update old lifecycle methods
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Version: 78.0.3904.97
- Method of installation: npm
- Swagger-UI version: 3.24.3
- Swagger/OpenAPI version: OpenAPI 3.0
Usage Example:
import SwaggerUI from "swagger-ui-react";
<SwaggerUI spec={doc.openApiSpec!} docExpansion={"none"} key={doc._id!} />
Describe the bug you're encountering
Getting the following warnings in the browser console:
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.
Please update the following components: Connect(r)
Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.
Please update the following components: Connect(r)
Additional context or thoughts
Please update lifecycle methods to use UNSAFE keyword.
The version of react they depend on was published 2 years ago, long before those methods became deprecated
Seeing a slightly different warning while testing components that import swagger-ui-react
:
componentWillReceiveProps:
Please update the following components: Connect(r), Provider
componentWillUpdate:
Please update the following components: Connect(r)
Any update on this?
Bump
Bump AGAIN
Facing the same issue:
Any solution?
I'm seeing this too. Bump!
Same problem here.
Is the React component still maintained ? No update on this issue since 3 years...
I've counted that the codebase contains:
In order to make the situation better, we have to replace each of this methods either with hooks or other SAFE lifecycle methods.
We can start issuing PRs and eliminate one method at a time. I'll be able to provide PR and merge very quickly if you give me a mention here.
Any first volunteers?