-
Notifications
You must be signed in to change notification settings - Fork 2k
Try #2: Upgrade @wordpress packages to pre-React 18 #73890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR modifies the release build for editing-toolkit To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-mMA-p2 |
88adc7e to
152c838
Compare
24ec7c2 to
2a2ed8d
Compare
3713c7d to
5f6357c
Compare
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~22292 bytes added 📈 [gzipped]) DetailsCommon code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~4880 bytes removed 📉 [gzipped]) DetailsSections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~14342 bytes added 📈 [gzipped]) DetailsReact components that are loaded lazily, when a certain part of UI is displayed for the first time. Moment.js Locales (~3055 bytes added 📈 [gzipped]) DetailsLocale data for moment.js. Unless you are upgrading the moment.js library, changes in these chunks are suspicious. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
400d12e to
4c40d8e
Compare
|
The e2e issue happens in this context:
This does not happen in production, and it also doesn't happen when I'm logged into my main account in calypso.live. |
|
The fix was pretty straightforward: In this code, The main concern I have from this is whether there are other instances of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work here @tyxla! This is a huge amount of changes for the upgrade 😅 Hopefully the next round is easier!
With the e2e bug fix, I realized that this PR adds empty dependency arrays ([]) to a lot of useSelect calls without necessarily adding dependencies. I went through the PR and commented on each missing dependency I could find in each useSelect call where we're adding the dependency array. (I think this should be as extensive as possible with human eyes 😅)
Some of these might not be functionally needed, but I think it's worth fixing just in case they would introduce bugs. I decided to comment first, and then I'll work on updating all of them.
Edit: updated all of these in 5955722
apps/editing-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-modal/index.tsx
Outdated
Show resolved
Hide resolved
...ting-toolkit/editing-toolkit-plugin/editor-site-launch/src/launch-steps/final-step/index.tsx
Outdated
Show resolved
Hide resolved
...t/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx
Outdated
Show resolved
Hide resolved
87108f1 to
5955722
Compare
tyxla
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your help addressing the last bits, @noahtallen! 🙌
I've spent quite some time verifying that these are all correct and I've made some observations about a few that we could further polish. This took a while: 😅
I'll take care of them immediately, and do some smoke testing before marking this as ready to review.
...t/editing-toolkit-plugin/wpcom-block-editor-nav-sidebar/src/components/nav-sidebar/index.tsx
Outdated
Show resolved
Hide resolved
apps/editing-toolkit/package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that we intentionally didn't change this dependency, because:
- The
@wordpress/envpackage isn't a dependency of any other package and doesn't have any other packages as dependencies. Therefore, it can be updated separately and independently. - There's a breaking change in the way the PHPUnit tests are set up. Ideally, we should take care of that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good observation, that matches my experience with wp-env updates. (I also have a WIP PR somewhere for this phpunit change, which I should resurrect!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary because compose types aren't very friendly, but dealing with them is work for another time and another PR.
package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are removing some of those type packages because they augment or redeclare the @wordpress/data types, which is in direct conflict with the new way we're consuming @wordpress/data types - directly from the package.
package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinning to avoid type conflicts and a waterfall of unwanted dependencies.
package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package has been a bit merciless with breaking changes sneaking into minor versions, so we need to pin it down to avoid them inadvertently sneaking into the code.
packages/social-previews/types.d.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are a classic example of types we needed to specifically declare because those packages also attempted to declare the @wordpress/data module, which directly entered in conflict with the new package-provided @wordpres/data types. Ideally, each of those packages should provide types directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd be worth trying to fix the DT defs? (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wordpress__rich-text/index.d.ts)
Technically, I guess those are broken for everyone with new wordpress data versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary because multiple packages are attempting to declare this global.
1641572 to
d8da603
Compare
|
The failing e2e tests are flaky and seem to be failing in other branches. I think this one is ready for review 👀 |
012518d to
b8a0f10
Compare
|
Given that most of the changes are TS changes and I have a green light, in light of how quickly this can get stale, I'm inclined to ship it now. I already did extensive testing and I'm going to do so on staging, too. Thanks everyone 🙌 |
cc @jsnajdr - could this be something we could detect and prevent within |
Yes, with ever-changing The bad thing is that the selector returns a different value on each call, although the inputs are, at least semantically, the same. So, the main question is why The A second place where query object equality is checked is the reducer that stores the query results. Here the query object is serialized to a string with the
If it turns out that Other than that, this is more like a typical React issue with immutability and effect dependencies, not something |
|
Nice clarification! |
|
Translation for this Pull Request has now been finished. |


This PR aims to upgrade the
@wordpresspackages to versions before upgrading to React 18.The second take of #73155.
Does a lot of dependency and TS changes. There are some dependency compromises and specific pinning, but this PR aims to make a step forward towards updating the
@wordpresspackages to the latest version and restarting their regular periodic upgrades.I think it requires thorough testing of all major flows.