Update `@wordpress/data` to version `4.27.3` using `patch-package`
Feature Description
Following on from the update to @wordpress/data 4.23.0 in https://github.com/google/site-kit-wp/issues/1769, we should update to version 4.27.3. This is the latest version that supports (via @wordpress/element) React 16.
Based on the learning from #6356 and recent hackathon exploration and its output branch here, we will use patch package to mitigate the bug discovered while working on the aforementioned issue.
This is a temporary solution until we are able to upgrade to v9.0.0 or later version of @wordpress/data in which version, the bug has been officially fixed! See this PR.
For patch-package, see the note about CI and caching here. Note that, our workflows does not cache node_module but the global package cache instead, so changes in patches folder should not require any changes for caching mechanism, just noting for completeness.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
@wordpress/datashould be updated to version 4.27.3, and necessary patches should be applied usingpatch-packageto mitigate the discovered bug.- No JavaScript errors and no new warnings should be triggered when visiting any Site Kit pages and Widgets (Dashboard, Settings, WP Dashboard, Adminbar widgets etc).
- All JavaScript unit tests and E2E tests should continue to pass and no regression should be introduced.
Implementation Brief
Note for IB author: the hackathon branch can be used for a starting point while drafting the IB and/or implementing the issue in Execution.
- In
package.json:- [ ] Update
@wordpress/datato4.27.3.- [ ] Update the
@wordpress/composeto3.25.3to match with the version used by the updated version of@wordpress/data.
- [ ] Update the
- [ ] Add
patch-packageas a dev dependency.- [ ] Add
"postinstall": "patch-package"script inpackage.json.
- [ ] Add
- [ ] Update
- [ ] Across the codebase, search for
__experimentalResolveSelectand replace withresolveSelect. - [ ] Compare the
packages/data/src/components/use-select/index.jsfile ingutenbergrepo between thev4.23.0andv4.27.3version, and make note of the changes to prepare for a patch.- [ ] A diff can be generated using
git diff @wordpress/[email protected] @wordpress/[email protected] -- packages/data/src/components/use-select/index.js. - [ ] Distinguish between the relevant change pertaining to the
__experimentalSubscribeStore. - [ ] Patch the
node_modules/@wordpress/data/build-module/components/use-select/index.js(used by jest tests) andnode_modules/@wordpress/data/build/components/use-select/index.js(used by plugin build). - [ ] See the
patches/@wordpress+data+4.27.3.patchfile in linked branch for an example.
- [ ] A diff can be generated using
- [ ] While the previous failing tests should pass after the patch, it would be beneficial to create additional tests in
assets/js/googlesitekit/datathat has some additional tests for verifying the changes.- [ ] A selector that selects from multiple stores conditionally,
- [ ] Another similar selector, that does the same thing, using
createRegistrySelector. - [ ] See here for some example.
Test Coverage
- All existing tests should pass.
- See the above note in IB for additional tests.
QA Brief
- This is an infra change and no user facing changes should be observed.
- It may be beneficial to perform a general smoke testing of the plugin, or being vigilant about any odd behaviors during plugin release testing, looking out for any UI stalls, errors or console errors.
- QA:Eng - all unit, integration and e2e tests should continue to pass locally and in CI.
Changelog entry
- Update
@wordpress/datato version4.27.3, including a patch to avoid breaking changes.
All sounds good to me 👍🏻
IB ✅
QA Update ✅
- Tested on dev environment.
- Done smoke testing of all functionalities.
- Verified all widgets on main and entity dashboard.
- Verified WP dashboard widgets.
- Verified settings page.
I completed my testing but moving this back to QA. As per QAB it requires QA:Eng review also.
@tofumatt @techanvil Can you please confirm if all unit, integration and e2e tests are pass locally and in CI during CR ? If yes, then I will move this to approval.
@mohitwp Yes, everything is passing, this can be moved to Approval 👍🏻
Thank you @tofumatt ! Moving this back to approval.