Skip to content

4.x release #7341

@char0n

Description

@char0n

The goal of this issue is to update React to 17.x.y and have a remote branch on this repository running on React v17.x.y without any issues. More info in pre-release article: https://swagger.io/blog/api-design/what%E2%80%99s-ahead-for-swaggerui-v4-and-swaggereditor-v4/

Current state

We're currently running SwaggerUI on [email protected] which was been released 8 months ago. React@15 release branch is more then 5 years old. It's time we start looking into what work would be required to make the update.

Update methodology

We understand that merely updating React itself will not suffice. There is network of other libraries connected to React that need to update as well. We can use current test suite for detecting any anomalies after the React update. These anomalies needs to be documented first before we move for eliminating them. This issue will maintain a list of all anomalies that need to be eliminated along with the list of tasks that need to performed.

Branch

All work in being done on release/4.x branch. Draft PR has been opened as well from release/4.x branch.

Community involvement

Any community involvement is welcomed! If you you're aware of any problem regarding usage of newer version of React then 15.0.7, please let us know in issue comments.

Resources

Tasks

Update React to 17.x.y #

react and react-dom packages have been updated to v17.0.2. Console did not reported any problem. Tests immediately stopped passing.

Updated Name Used version Latest version
react 15.7.0 17.0.2
react-dom 15.7.0 17.0.2

Detect and update all React related dependencies that will require update too #

Production Dependencies

Updated Name Used version Latest version
react-immutable-pure-component 1.2.3 2.2.0
react-inspector 2.3.1 5.1.1
react-redux 4.4.10 7.2.4
redux 3.7.2 4.1.0
redux-immutable 3.1.0 4.0.0

Development Dependencies

Updated Name Used version Latest version
enzyme 2.9.1 3.11.0
react-test-renderer 15.7.2 17.0.2

Anomalies

just-test-in-node npm script fails #

just-test-in-node npm script triggers errors. Current version of enzyme doesn't support react@17. In order for enzyme to work with react@17 we need to update enzyme to latest version and use @wojtekmaj/enzyme-adapter-react-17 adapter. Fixed in 6405fe7.

test:unit-jest npm script fails #

Problem is with latest version of enzyme and that returns a cheerio wrapper. This is a breaking change and we have to somehow deal with it. More about this problem in enzymejs/enzyme#1162. Related issue is that cheerio now doesn't escape quotes: " is now interpreted as " by cheerio, more in cheeriojs/cheerio#319. Empty string attributes on HTML tags are now supplied with empty string value of "" instead of making them boolean attributes. Fixed in 3ed335e.

Cypress tests are failing #

React@17 no longer support react-addons-perf. Documentation says following As of React 16, react-addons-perf is not supported. Please use your browser’s profiling tools to get insight into which components re-render. Learn more about this problem here. We'll be removing win.Perf assign from code. Fixed in ebcd552.

react-inspector has different API now #

initialExpandedPaths prop on ObjectInspector component changed to expandPaths.

warnings during npm install about non matching library versions #

react-debounce-input: requires a peer of react@^15.3.0 || ^16.0.0. Waiting for a new release witch official react@17 support without warning. Installed version 3.2.4. Ref nkbt/react-debounce-input#137

react-motion: requires a peer of react@^0.14.9 || ^15.3.0 || ^16.0.0. Very old not any more maintained library. The library usage was replaced by simple object in following shape: { stiffness: 170, damping: 26 }

request-promise: [email protected] requires a peer of request@^2.34 but none is installed. This will go away after we uninstall nightwatch.

request-promise-core: [email protected] requires a peer of request@^2.34 but none is installed. This will go away after we uninstall nightwatch.

tsutils: [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. This will stay with us as it's transitive dependency of eslint-plugin-jest. If we introduce TypeScript into codebase, it will go away.

Fix npm security vulnerabilites #

All npm security vulnerabilities (except 4) has been fixed. The 4 pending vulnerabilities are comming from transitive deps of webpack@4 and cannot be easily fixed. They will go away after we update to webpack@5. For now it's completely OK to dismiss them as they pose no thread. Fixed in 3162614

replace @kyleshockey/* libraries with original ones #

@kyleshockey/object-assign-deep - replaced by lodash/merge. If behavior not be compatible we'll use lodash/mergeWith.

@kyleshockey/xml - by installing stream library directly, we can use original xml library without the fork.

Fixed in 49c4bc4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions