Experimental: Prevent diffing error using key for each router region of Chips and Checkbox List (#52210)

This commit is contained in:
Tung Du 2024-10-24 13:44:03 +07:00 committed by GitHub
parent 9314a022de
commit 7bd713c5ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Experimental: Fix diffing error for Checkbox List and Chips blocks.

View File

@ -55,6 +55,7 @@ final class ProductFilterCheckboxList extends AbstractBlock {
$wrapper_attributes = array(
'data-wc-interactive' => esc_attr( $namespace ),
'data-wc-context' => wp_json_encode( $checkbox_list_context, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
'data-wc-key' => wp_unique_prefixed_id( $this->get_full_block_name() ),
'class' => esc_attr( $classes ),
'style' => esc_attr( $style ),
);

View File

@ -54,6 +54,7 @@ final class ProductFilterChips extends AbstractBlock {
$wrapper_attributes = array(
'data-wc-interactive' => esc_attr( $namespace ),
'data-wc-context' => wp_json_encode( $checkbox_list_context, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
'data-wc-key' => wp_unique_prefixed_id( $this->get_full_block_name() ),
'class' => esc_attr( $classes ),
'style' => esc_attr( $style ),
);