swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

swagger-ui-react - update old lifecycle methods

Open nirsky opened this issue 4 years ago • 8 comments

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.

nirsky avatar Nov 27 '19 12:11 nirsky

The version of react they depend on was published 2 years ago, long before those methods became deprecated

kyeotic avatar Feb 28 '20 00:02 kyeotic

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)

silverwind avatar May 11 '20 12:05 silverwind

Any update on this?

fcoralsasso avatar Nov 09 '20 18:11 fcoralsasso

Bump

wshart avatar Dec 01 '20 18:12 wshart

Bump AGAIN

DjVreditel avatar May 05 '21 17:05 DjVreditel

Facing the same issue: Screen Shot 2022-07-13 at 14 10 07

Any solution?

masoudsoleymani avatar Jul 13 '22 13:07 masoudsoleymani

I'm seeing this too. Bump!

syshriki9 avatar Aug 24 '22 04:08 syshriki9

Same problem here.

bmpf avatar Sep 08 '22 10:09 bmpf

Is the React component still maintained ? No update on this issue since 3 years...

Jul13nT avatar Nov 22 '22 14:11 Jul13nT

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?

char0n avatar Nov 23 '22 13:11 char0n