Skip to content

Blocks: In scan_delimiters extract static method #43984

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 2 commits into from
Jun 20, 2025

Conversation

jeherve
Copy link
Member

@jeherve jeherve commented Jun 17, 2025

Ports 185482-ghe-Automattic/wpcom

Proposed changes:

When scan_delimiters() is attempting to find the end of an HTML
comment, it’s calling a convenience method which is also a closure
in the code (or an anonymous function). This carries a marginal
performance overhead and limits reuse.

In this change that method is extracted onto the class as its own static
method; this should simplify reasoning about the method itself and
provide a perofmrnace lift to the calling code.

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:

Functionality should not change, I would consequently recommend checking if the tests still pass.

Ports 185482-ghe-Automattic/wpcom

When `scan_delimiters()` is attempting to find the end of an HTML
comment, it’s calling a convenience method which is also a closure
in the code (or an anonymous function). This carries a marginal
performance overhead and limits reuse.

In this change that method is extracted onto the class as its own static
method; this should simplify reasoning about the method itself and
provide a perofmrnace lift to the calling code.
@jeherve jeherve requested a review from kraftbj June 17, 2025 15:43
@jeherve jeherve self-assigned this Jun 17, 2025
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Focus] Performance [Status] Needs Review This PR is ready for review. [Pri] Normal labels Jun 17, 2025
Copy link
Contributor

github-actions bot commented Jun 17, 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/block-delimiter-extract-no-anonymous-function branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/block-delimiter-extract-no-anonymous-function

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

Copy link
Contributor

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!

Copy link

jp-launch-control bot commented Jun 17, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/block-delimiter/src/class-block-delimiter.php 205/271 (75.65%) 0.01% -1 💚

Full summary · PHP report · JS report

@kraftbj kraftbj added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Jun 19, 2025
@jeherve jeherve merged commit 39c83c4 into trunk Jun 20, 2025
71 checks passed
@jeherve jeherve deleted the update/block-delimiter-extract-no-anonymous-function branch June 20, 2025 13:19
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jun 20, 2025
grzegorz-cp added a commit that referenced this pull request Jun 23, 2025
* Getting chart data

* Updating chart and data transformation

* Implement interactive stats chart with clickable metric tabs and single-series visualization

* Fixing Stats card tab styling

* Fixing Stats card tab CSS and label position

* changelog

* Added new card style for Stats in My Jetpack

* Empty data notification

* Empty data notification styling

* Adding charts package again

* Updating CSS after review, adding click redirect

* pnpm lock update

* script changes

* Social Previews: Fix Mastodon preview stretching (#44019)

* Fix Mastodon description overflow with previews

* changelog

* Lockfile

* Bump to 12

* Admin Menu: Add "Dashboard > Updates" screen to Simple sites (#44024)

* Admin Menu: Add "Dashboard > Updates" menu to Simple sites

* Remove WP version

* Add changelog

* Exclude VIP sites, since the plugins (and their updates) are managed a little bit differently there, and parity with Atomic sites is also not important for them.

* Check that function exists

* Zendesk: Add CSAT endpoint (#44029)

* Blocks: In scan_delimiters extract static method (#43984)

Ports 185482-ghe-Automattic/wpcom

When `scan_delimiters()` is attempting to find the end of an HTML
comment, it’s calling a convenience method which is also a closure
in the code (or an anonymous function). This carries a marginal
performance overhead and limits reuse.

In this change that method is extracted onto the class as its own static
method; this should simplify reasoning about the method itself and
provide a perofmrnace lift to the calling code.

Co-authored-by: Dennis Snell <[email protected]>
Co-authored-by: Brandon Kraft <[email protected]>

* WordAds: Remove package from monorepo (#44025)

* Fix test description

* Delete packages/wordads

* Add changelog

* Fix project lint issues

* Subscriptions: fix subcriber stats links when stats module is not active (#44037)

* Subscriber dashboard: pass stats module status to JS

We will use it to change some of the links when the module is not active.

* Add extra space for better readability

* Pass new prop to newsletter component

* Use new prop to change the status of the links

- On WordPress.com sites, always link to WordPress.com.
- On self-hosted sites, check for the status of the Stats module:
    * If it's active, link to the wp-admin stats page.
    * If it is not active, link to the Jetpack cloud subscribers page.

* Update test accordingly

* Update dashboard links to be aware of stats module status

* Add changelog

* Redirect folks to Calypso blue stats when stats module is inactive

This is now possible because the Subscribers stats sub-page of the Calypso blue stats is not accessible, even when you do not use the Stats module.

See pejTkB-24B-p2

* simplify internal link logic

See https://github.com/Automattic/jetpack/pull/44037/files#r2158706216

* Update doc comment

* Be more explicit about stats being enabled in original test

See #44037 (comment)

Co-authored-by: Allison Levine <[email protected]>

---------

Co-authored-by: Tony Arcangelini <[email protected]>
Co-authored-by: Allison Levine <[email protected]>

* Update dependency copy-webpack-plugin to v13 (#44040)

Co-authored-by: Renovate Bot <[email protected]>

* fixing package dependency

* Update margin-inline-end

Co-authored-by: Manzoor Wani <[email protected]>

* Revert "fixing package dependency"

This reverts commit b592fd9.

* Charts webpack fix

* changelog

* Fixing timezones to match Stats and hiding 0 diff values for catds

---------

Co-authored-by: Gergely Márk Juhász <[email protected]>
Co-authored-by: Miguel Torres <[email protected]>
Co-authored-by: Kosta <[email protected]>
Co-authored-by: Jeremy Herve <[email protected]>
Co-authored-by: Dennis Snell <[email protected]>
Co-authored-by: Brandon Kraft <[email protected]>
Co-authored-by: tbradsha <[email protected]>
Co-authored-by: Tony Arcangelini <[email protected]>
Co-authored-by: Allison Levine <[email protected]>
Co-authored-by: Automattic Bot <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Manzoor Wani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Performance [Package] Block Delimiter [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants