From fce3ac95ed5e967bccf44f55f772927d86f55eb7 Mon Sep 17 00:00:00 2001 From: Andrii Lysenko Date: Thu, 14 Dec 2023 09:29:27 -0800 Subject: [PATCH 1/6] Sharing Buttons: improve event listener perfrormance --- .../blocks/sharing-button/sharing-button.php | 5 +- .../extensions/blocks/sharing-buttons/save.js | 3 +- .../extensions/blocks/sharing-buttons/view.js | 69 ++++++++++--------- 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/projects/plugins/jetpack/extensions/blocks/sharing-button/sharing-button.php b/projects/plugins/jetpack/extensions/blocks/sharing-button/sharing-button.php index e10d96d2c109a..ecb32dfa75b3c 100644 --- a/projects/plugins/jetpack/extensions/blocks/sharing-button/sharing-button.php +++ b/projects/plugins/jetpack/extensions/blocks/sharing-button/sharing-button.php @@ -44,7 +44,7 @@ function render_block( $attr, $content, $block ) { $style_type = $block->context['styleType']; $style = 'style-' . $style_type; - $data_shared = 'sharing-' . $attr['service'] . '-' . $post_id . $attr['service']; + $data_shared = 'sharing-' . $attr['service'] . '-' . $post_id; $query = 'share=' . $attr['service'] . '&nb=1'; $services = get_services(); @@ -65,7 +65,8 @@ function render_block( $attr, $content, $block ) { Jetpack_Gutenberg::load_assets_as_required( __DIR__ ); $component = '
  • '; - $component .= ''; + $component .= ''; $component .= $icon; $component .= ''; $component .= ''; diff --git a/projects/plugins/jetpack/extensions/blocks/sharing-buttons/save.js b/projects/plugins/jetpack/extensions/blocks/sharing-buttons/save.js index cf4a6979b550e..a797e3391d42d 100644 --- a/projects/plugins/jetpack/extensions/blocks/sharing-buttons/save.js +++ b/projects/plugins/jetpack/extensions/blocks/sharing-buttons/save.js @@ -2,8 +2,9 @@ import { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor'; export default function save() { const className = 'jetpack-sharing-buttons__services-list'; + const id = 'serivces-list'; const blockProps = useBlockProps.save( { className } ); const innerBlocksProps = useInnerBlocksProps.save( blockProps ); - return