Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

React upgrade 16.9 #688

Merged
merged 3 commits into from
May 9, 2019
Merged

React upgrade 16.9 #688

merged 3 commits into from
May 9, 2019

Conversation

cartogram
Copy link
Contributor

@cartogram cartogram commented May 6, 2019

This pull closes https://github.com/Shopify/web/issues/13363 by upgrading to React@16.9.0.alpha0, this includes:

  • Upgrading react and react-dom (note, there are no tags for the updated types yet)
  • Modifying relevant parts of the react-testing library
  • Found all skipped tests waiting on this upgrade and fixed them
  • Removed the utility that whitelisted react errors from the console

🎩 There should be no failing tests, no async-act related skipped tests and no act-related console errors.

@cartogram cartogram force-pushed the react-upgrade-16.9 branch 14 times, most recently from 09568e3 to 3175af5 Compare May 9, 2019 04:22
packages/enzyme-utilities/src/index.ts Show resolved Hide resolved
if (returnValue instanceof Promise) {
return returnValue.then(ret => {
if (isPromise(returnValue)) {
return Promise.resolve(promise as Promise<any>).then(ret => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should leave a comment of why you check that returnValue is a promise, not promise

packages/enzyme-utilities/src/index.ts Outdated Show resolved Hide resolved
packages/react-form/src/hooks/list/list.ts Show resolved Hide resolved
packages/react-form/src/hooks/test/form.test.tsx Outdated Show resolved Hide resolved
packages/react-testing/src/element.ts Outdated Show resolved Hide resolved
packages/react-testing/src/element.ts Outdated Show resolved Hide resolved

return result;
if (isPromise(result)) {
return Promise.resolve(promise).then(afterResolve) as any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same request as above re: clarifying comments for this and the type casting of act above

packages/react-testing/src/root.tsx Outdated Show resolved Hide resolved
packages/react-testing/src/root.tsx Outdated Show resolved Hide resolved
@cartogram cartogram changed the title [WIP] React upgrade 16.9 React upgrade 16.9 May 9, 2019
Copy link
Contributor

@marutypes marutypes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me f you address the unnecessary awaits, rebase on master, and remove the skip from the test in react-form

packages/react-form/src/hooks/test/form.test.tsx Outdated Show resolved Hide resolved
@cartogram cartogram force-pushed the react-upgrade-16.9 branch 4 times, most recently from 88cdc45 to 281f33c Compare May 9, 2019 17:26
@cartogram cartogram requested a review from lemonmade May 9, 2019 17:28
@cartogram cartogram force-pushed the react-upgrade-16.9 branch from 281f33c to 54a4850 Compare May 9, 2019 17:28
Copy link
Member

@lemonmade lemonmade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments, but overall I think this is looking good to ship now 👍

.find('button', {type: 'submit'})!
.trigger('onClick', clickEvent());
wrapper.act(() => {
wrapper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should need to wrap this in an act?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing fails the test actually. It can't find the element.

.find('button', {type: 'submit'})!
.trigger('onClick', clickEvent());
wrapper.act(() => {
wrapper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, same as above.

packages/react-form/src/hooks/test/form.test.tsx Outdated Show resolved Hide resolved
packages/react-graphql/src/hooks/tests/mutation.test.tsx Outdated Show resolved Hide resolved
importRemote.act(() => {
requestIdleCallback.runIdleCallbacks();
await importRemote.act(async () => {
await requestIdleCallback.runIdleCallbacks();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to await on the result of calling load instead then?

@cartogram cartogram force-pushed the react-upgrade-16.9 branch from 54a4850 to ed3a5b1 Compare May 9, 2019 18:24
@cartogram cartogram merged commit 6dacbc0 into master May 9, 2019
@cartogram cartogram deleted the react-upgrade-16.9 branch May 9, 2019 18:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants