Skip to content

Blocks: use new useResizeObserver hook #43334

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

Merged
merged 4 commits into from
May 8, 2025

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented May 1, 2025

Fixes #39922
Fixes VULCAN-92

Proposed changes:

  • This PR updates the useResizeObserver usage (from @wordpress/compose) in two instances: in the Story block, and the Image Compare block.
  • The new API and behaviour of this hook was introduced in WordPress 6.7, which is now our minimum supported version of WordPress.
  • I've included border-box as the box model, though for the blocks I notice no difference in testing. This appears to be more beneficial for responsive designs as it includes padding and borders, so chose to keep it.
  • This does not include changes to the instance in the forms package (being dealt with here), nor the Tiled Gallery block instance as this is in the edit.native.js file, which is used on mobile (checked in with mobile here: p1746182839589319-slack-C0180B5PRJ4 )

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

n/a

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

On a local development site or Jurassic Ninja or WoA site with this PR applied using the beta tester plugin, or on a sandboxed Simple site with this PR applied by using the commands in the generated comment below:

  • Add a Story block to a post. Ensure it works as expected in the editor and front-end
  • Add an Image Compare block to a post. Ensure it works as expected in the editor and front-end

@coder-karen coder-karen added [Status] In Progress [Type] Janitorial [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels May 1, 2025
@coder-karen coder-karen self-assigned this May 1, 2025
Copy link
Contributor

github-actions bot commented May 1, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/useResizeObserver-hook-usage branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/useResizeObserver-hook-usage

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Block] Image Compare [Block] Story [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels May 1, 2025
Copy link
Contributor

github-actions bot commented May 1, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

Copy link

jp-launch-control bot commented May 1, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/extensions/blocks/story/player/player-ui.js 1/63 (1.59%) -0.11% 4 💔
projects/plugins/jetpack/extensions/blocks/image-compare/edit.js 15/37 (40.54%) 1.83% 3 ❤️‍🩹

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

@coder-karen coder-karen marked this pull request as ready for review May 2, 2025 12:16
@coder-karen coder-karen requested a review from a team May 2, 2025 14:45
@coder-karen coder-karen added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 2, 2025
@darssen darssen self-requested a review May 5, 2025 10:27
Copy link
Contributor

@darssen darssen left a comment

Choose a reason for hiding this comment

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

Not very familiar with the code, but was able to test in all 3 environments (self-hosted, woA and simple) and blocks were working fine without errors.

Thanks for taking care of this @coder-karen

@coder-karen coder-karen added I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels May 8, 2025
@coder-karen coder-karen merged commit 31c28b5 into trunk May 8, 2025
69 of 71 checks passed
@coder-karen coder-karen deleted the update/useResizeObserver-hook-usage branch May 8, 2025 10:04
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Compare [Block] Story [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocks: use new useResizeObserver hook in @wordpress/compose
2 participants