Show global attribute slug without 'pa_' prefix (#41333)
* Show global attribute slug without 'pa_' prefix * Make implementation more robust
This commit is contained in:
parent
b24591432d
commit
8d731f8a43
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
Comment: Show global attribute slug without 'pa_' prefix
|
||||
|
||||
|
|
@ -52,6 +52,10 @@ function isNewAttributeListItem( attribute: NarrowedQueryAttribute ): boolean {
|
|||
return attribute.id === -99;
|
||||
}
|
||||
|
||||
function sanitizeSlugName( slug: string | undefined ): string {
|
||||
return slug && slug.startsWith( 'pa_' ) ? slug.substring( 3 ) : '';
|
||||
}
|
||||
|
||||
export const AttributeInputField: React.FC< AttributeInputFieldProps > = ( {
|
||||
value = null,
|
||||
onChange,
|
||||
|
@ -211,7 +215,7 @@ export const AttributeInputField: React.FC< AttributeInputFieldProps > = ( {
|
|||
tooltipText={
|
||||
item.isDisabled
|
||||
? disabledAttributeMessage
|
||||
: item.slug
|
||||
: sanitizeSlugName( item.slug )
|
||||
}
|
||||
>
|
||||
{ isNewAttributeListItem( item ) ? (
|
||||
|
|
Loading…
Reference in New Issue