Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix: issue with underscore in slug
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhtungdu committed Jul 27, 2022
1 parent 9a85425 commit d9baa88
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion assets/js/blocks/attribute-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const AttributeFilterBlock = ( {
const count = filteredTerm ? filteredTerm.count : 0;

return {
value: formatSlug( term.slug ),
value: term.slug,
name: decodeEntities( term.name ),
label: (
<Label
Expand Down Expand Up @@ -526,6 +526,17 @@ const AttributeFilterBlock = ( {
tokens = [ tokens[ tokens.length - 1 ] ];
}

tokens = tokens.map( ( token ) => {
const displayOption = displayedOptions.find(
( option ) =>
formatSlug( option.value ) === token
);

return displayOption
? displayOption.value
: token;
} );

const added = difference( tokens, checked );

if ( added.length === 1 ) {
Expand Down

0 comments on commit d9baa88

Please sign in to comment.