swagger-ui-react - update old lifecycle methods

Created on 27 Nov 2019  路  5Comments  路  Source: swagger-api/swagger-ui

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.

Most helpful comment

Bump

All 5 comments

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)

So they forgot about React?

Any update on this?

Bump

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DavidBiesack picture DavidBiesack  路  4Comments

ilnurshax picture ilnurshax  路  3Comments

fehguy picture fehguy  路  3Comments

MartinMuzatko picture MartinMuzatko  路  4Comments

nulltoken picture nulltoken  路  3Comments