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

Update dependencies to support react 17 #8305

Merged
merged 10 commits into from
Feb 21, 2022
Merged

Update dependencies to support react 17 #8305

merged 10 commits into from
Feb 21, 2022

Conversation

chihsuan
Copy link
Member

@chihsuan chihsuan commented Feb 14, 2022

Fixes #8283

This PR updates the dependencies to support react 17 with the following changes.

  • Updated dependencies to support react 17. d33b4ea
  • Updated test snapshots due to wp component package updated. 734749d
  • Added explat-client-react-helpers.tsx from wp-calypso/packages/explat-client-react-helpers to pacakges/explat as temporary solution to support react 17. 22befc9 -> Update webpack.config for latest published explat-client-react-helpers. c2fc69a
  • Updated SnackbarList with latest react-spring. 37ca4a5
  • Removed '@wordpress/components/src/visually-hidden/style' import (included in wp-components). 42a4dde
  • Updated interpolateComponents import path -> '@automattic/interpolate-components' 18b60b9
  • Updated createNotice actions param onclick (deprecated) -> callback. 4666b8f -> Update dependencies to support react 17 #8305 (review)
  • Fixed task-list-item and display-options tests. a00c320 2b03298

Details: p90Yrv-2Lk-p2

Detailed test instructions:

  • Check out this branch
  • Clean repo: npm run clean && rm -rf node_modules && rm -rf packages/**/node_modules
  • Reinstall and build: npm install && npm run build
  • Test: npm run test
  • Smoke test the whole app

Copy link
Contributor

@rjchow rjchow left a comment

Choose a reason for hiding this comment

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

Nice work! Appreciate this very laborious and often thankless work.
Automated tests and smoke testing went well, almost all the changes look fine.

I went over the changelogs of every package that was updated and the only things that stood out were:

@chihsuan
Copy link
Member Author

* Most of them had breaking changes of IE11 deprecation and Node.JS LTS 12 as the minimum version - wonder if we should add this to our own changelog?

* @wordpress/components deprecated some props (isPrimary, isSecondary, isTertiary, isLink) in `<Button>` and we use those props, so we should probably make a separate issue to fix them before they completely remove support. https://github.com/WordPress/gutenberg/blob/81e8e0f7c999df3cc43ef97cb2913779c0190eff/packages/components/CHANGELOG.md#deprecation-1

@rjchow Thanks for spotting them. I've add IE11 deprecation note to changelogs in bd4a659. I think our minimum Node JS version is already 12 as defined in the package.json.

Also created a follow-up issue #8313 for <Button>

@chihsuan chihsuan force-pushed the update/react-17 branch 2 times, most recently from fc46931 to 44ec66c Compare February 17, 2022 03:19
@ilyasfoo ilyasfoo self-requested a review February 17, 2022 04:41
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

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

Thanks so much for the work here, @chihsuan! It's super neat that you've also properly separated the changes into different commits, definitely helped with reviewing there.

I've found an issue with createNotice changes. Everything else is looking good so far!

@@ -69,7 +69,7 @@ class ReviewsPanel extends Component {
actions: [
{
label: __( 'Undo', 'woocommerce-admin' ),
onClick: () => {
callback: () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Updated createNotice actions param onclick (deprecated) -> callback. 4666b8f

I've tested this change and found out the new callback didn't get triggered. I've tried to change it back to onClick and it worked. Also, looking at the source for core/notices, I'm seeing onClick is still used (at least in the typedef) and no reference to callback is found. Kinda weird, where did you find the deprecated notice for onClick? 🤔

Copy link
Member Author

@chihsuan chihsuan Feb 17, 2022

Choose a reason for hiding this comment

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

Good catch. I think you're right. It's still using onClick. I found the callback from typescript warnings and @types/wordpress__notices.

Screen Shot 2022-02-17 at 16 45 44
Screen Shot 2022-02-17 at 16 45 53
.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://www.npmjs.com/package/@types/wordpress__notices

The last published is a year ago. : (

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me drop this commit 4666b8f and possibly fill an issue on Gutenberg.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've reverted the changes and confirmed they actually changed from callback to onClick (WordPress/gutenberg#17206), but didn't update the file in DefinitelyTyped repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. Yeah it seems that'll need an update

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! It seems that the original owner for the type module was an a11n, but no longer works here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tagged the other maintainers from @types/wordpress__components 🥲

@chihsuan chihsuan force-pushed the update/react-17 branch 3 times, most recently from c2fc69a to 9d9ce64 Compare February 17, 2022 09:43
@ilyasfoo ilyasfoo self-requested a review February 18, 2022 09:07
Copy link
Contributor

@ilyasfoo ilyasfoo left a comment

Choose a reason for hiding this comment

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

I confirm that createNotice is working again. LGTM!

@adrianduffell adrianduffell self-requested a review February 18, 2022 09:14
Copy link
Contributor

@adrianduffell adrianduffell left a comment

Choose a reason for hiding this comment

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

Smoke test went well for me! Nice job on this @chihsuan 👍

@chihsuan chihsuan merged commit 5c20660 into main Feb 21, 2022
@chihsuan chihsuan deleted the update/react-17 branch February 21, 2022 02:34
ObliviousHarmony pushed a commit to woocommerce/woocommerce that referenced this pull request Mar 18, 2022
…n#8305)

* Upgrade dependencies to support react17

Update pkg

Update @wordpress/api-fetch and gridicons

* Update test snapshots

* Update SnackbarList with latest react-spring

* Mock data.dispatch for task-list-item.test.tsx

* Remove '@wordpress/components/src/visually-hidden/style' import

wp-components has included it

* Update interpolateComponents import path

* Fix display-options test

* Add changelogs

Update changelogs

* Add @automattic/explat-client-react-helpers back

* Update webpack.config for explat-client-react-helpers

Update webpack config comment

Fix grammar
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.

Investigate updating @woocommerce/components to support React 17
4 participants