-
Notifications
You must be signed in to change notification settings - Fork 219
[Product Collection] Fix: HTML Entity Decoding in Taxonomy Controls #11982
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +9 B (0%) Total Size: 1.53 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -250,6 +251,10 @@ const TaxonomyItem = ( { taxonomy, termIds, onChange }: TaxonomyItemProps ) => { | |||
onChange( newTermIds ); | |||
}; | |||
|
|||
const decodeHTMLEntities = ( value: string ) => { | |||
return decodeEntities( value ) || ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the need for the wrapping function and || ''
part? Seems like decodeEntities
always returns a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see in this code, it may return non-string value. Therefore, Just to be extra careful, I added || ''
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I implemented same thing for hand-picked products here, it resulted in an error. That’s why I added extra check here.
What
Fix HTML entity decoding issue in Taxonomy filters. You can see the issue in screenshot below:
Fixes #9242
Why
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog