Skip to content

Commit 425ee9b

Browse files
authored
fix(avatars): suppress statusLabel's useText warning when there is no configured status (#1540)
1 parent 33a7b1f commit 425ee9b

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

packages/avatars/.size-snapshot.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"index.cjs.js": {
3-
"bundled": 21575,
4-
"minified": 15751,
5-
"gzipped": 4068
3+
"bundled": 21646,
4+
"minified": 15766,
5+
"gzipped": 4079
66
},
77
"index.esm.js": {
8-
"bundled": 19857,
9-
"minified": 14240,
10-
"gzipped": 3849,
8+
"bundled": 19928,
9+
"minified": 14251,
10+
"gzipped": 3855,
1111
"treeshaked": {
1212
"rollup": {
13-
"code": 11621,
13+
"code": 11632,
1414
"import_statements": 341
1515
},
1616
"webpack": {
17-
"code": 12463
17+
"code": 12478
1818
}
1919
}
2020
}

packages/avatars/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"prop-types": "^15.5.7"
2626
},
2727
"peerDependencies": {
28-
"@zendeskgarden/react-theming": "^8.1.0",
28+
"@zendeskgarden/react-theming": "^8.65.0",
2929
"react": ">=16.8.0",
3030
"react-dom": ">=16.8.0",
3131
"styled-components": "^4.2.0 || ^5.0.0"

packages/avatars/src/elements/Avatar.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ const AvatarComponent = forwardRef<HTMLElement, IAvatarProps>(
5757
return ['status'].concat(statusMessage || []).join(': ');
5858
}, [computedStatus, badge]);
5959

60-
const statusLabel = useText(AvatarComponent, props, 'statusLabel', defaultStatusLabel);
60+
const shouldValidate = computedStatus !== undefined;
61+
const statusLabel = useText(
62+
AvatarComponent,
63+
props,
64+
'statusLabel',
65+
defaultStatusLabel,
66+
shouldValidate
67+
);
6168

6269
return (
6370
<StyledAvatar

0 commit comments

Comments
 (0)