-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Print a warning when both I18nProvider and own i18n string are missing #3172
base: main
Are you sure you want to change the base?
Conversation
recoveryText, | ||
errorIconAriaLabel, | ||
getRecoveryText: () => i18n('errorIconAriaLabel', restProps.errorIconAriaLabel), | ||
getErrorIconAriaLabel: () => i18n('recoveryText', restProps.recoveryText), |
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.
Make recovery text and error label lazy-loadable, only when this feature is used
warnOnce( | ||
component, | ||
`Localization is not provided for key ${key}. Provide the value as a prop or use I18nProvider` | ||
); |
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.
This is the change. Everything else is to fix appeared warnings
statusType, | ||
empty, | ||
loadingText, | ||
finishedText, | ||
filteringResultsText, | ||
errorText, | ||
recoveryText, | ||
isEmpty, | ||
isNoMatch, | ||
isFiltered, | ||
noMatch, | ||
hasRecoveryCallback, | ||
onRecoveryClick, |
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.
There is no point to destructure the object in a type declaration
@@ -209,21 +202,6 @@ export function useMultiselect({ | |||
renderHighlightedAriaLive, | |||
}); | |||
|
|||
const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({ |
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.
Unused code, there is a duplicate of this
components/src/multiselect/internal.tsx
Lines 115 to 128 in f7988a7
const tokens: TokenGroupProps['items'] = selectedOptions.map(option => ({ | |
label: option.label, | |
disabled: disabled || option.disabled, | |
labelTag: option.labelTag, | |
description: option.description, | |
iconAlt: option.iconAlt, | |
iconName: option.iconName, | |
iconUrl: option.iconUrl, | |
iconSvg: option.iconSvg, | |
tags: option.tags, | |
dismissLabel: i18n('deselectAriaLabel', deselectAriaLabel?.(option), format => | |
format({ option__label: option.label ?? '' }) | |
), | |
})); |
getErrorIconAriaLabel: () => undefined, | ||
getRecoveryText: () => props.recoveryText, |
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.
There is no i18n support for these strings in property filter. I will create a follow up ticket for that
93abc01
to
09e8751
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3172 +/- ##
==========================================
- Coverage 96.40% 96.40% -0.01%
==========================================
Files 784 784
Lines 22138 22150 +12
Branches 7592 7201 -391
==========================================
+ Hits 21343 21354 +11
- Misses 788 789 +1
Partials 7 7 ☔ View full report in Codecov by Sentry. |
getRecoveryText: () => i18n('errorIconAriaLabel', restProps.errorIconAriaLabel), | ||
getErrorIconAriaLabel: () => i18n('recoveryText', restProps.recoveryText), |
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.
The property names seem to have gotten mixed up here
getRecoveryText: () => i18n('errorIconAriaLabel', restProps.errorIconAriaLabel), | |
getErrorIconAriaLabel: () => i18n('recoveryText', restProps.recoveryText), | |
getRecoveryText: () => i18n('recoveryText', restProps.recoveryText), | |
getErrorIconAriaLabel: () => i18n('errorIconAriaLabel', restProps.errorIconAriaLabel), |
Description
Add a warning to help developers understand what is happening
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.