site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Update `@wordpress/data` to version `4.27.3` using `patch-package`

Open kuasha420 opened this issue 1 year ago • 1 comments

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/data should be updated to version 4.27.3, and necessary patches should be applied using patch-package to 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/data to 4.27.3.
      • [ ] Update the @wordpress/compose to 3.25.3 to match with the version used by the updated version of @wordpress/data.
    • [ ] Add patch-package as a dev dependency.
      • [ ] Add "postinstall": "patch-package" script in package.json.
  • [ ] Across the codebase, search for __experimentalResolveSelect and replace with resolveSelect.
  • [ ] Compare the packages/data/src/components/use-select/index.js file in gutenberg repo between the v4.23.0 and v4.27.3 version, 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) and node_modules/@wordpress/data/build/components/use-select/index.js (used by plugin build).
    • [ ] See the patches/@wordpress+data+4.27.3.patch file in linked branch for an example.
  • [ ] While the previous failing tests should pass after the patch, it would be beneficial to create additional tests in assets/js/googlesitekit/data that 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/data to version 4.27.3, including a patch to avoid breaking changes.

kuasha420 avatar Jun 06 '24 05:06 kuasha420

All sounds good to me 👍🏻

IB ✅

tofumatt avatar Jun 11 '24 22:06 tofumatt

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.

mohitwp avatar Jul 08 '24 07:07 mohitwp

I completed my testing but moving this back to QA. As per QAB it requires QA:Eng review also.

mohitwp avatar Jul 08 '24 07:07 mohitwp

@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 avatar Jul 08 '24 07:07 mohitwp

@mohitwp Yes, everything is passing, this can be moved to Approval 👍🏻

tofumatt avatar Jul 08 '24 08:07 tofumatt

Thank you @tofumatt ! Moving this back to approval.

mohitwp avatar Jul 08 '24 08:07 mohitwp