-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Provide a general summary of the issue here
Intl formatters creation is expensive and unnecessary creation should be avoided.
react-spectrum/packages/@react-aria/progress/src/useProgressBar.ts
Lines 53 to 58 in 69b8ec6
| let formatter = useNumberFormatter(formatOptions); | |
| if (!isIndeterminate && !valueLabel) { | |
| let valueToFormat = formatOptions.style === 'percent' ? percentage : value; | |
| valueLabel = formatter.format(valueToFormat); | |
| } |
🤔 Expected Behavior?
Only create a NumberFormatter if you intend to use it.
�� Current Behavior
Sometimes a NumberFormatter instance of useProgressBar can be wasted.
react-spectrum/packages/@react-aria/progress/src/useProgressBar.ts
Lines 53 to 58 in 69b8ec6
| let formatter = useNumberFormatter(formatOptions); | |
| if (!isIndeterminate && !valueLabel) { | |
| let valueToFormat = formatOptions.style === 'percent' ? percentage : value; | |
| valueLabel = formatter.format(valueToFormat); | |
| } |
💁 Possible Solution
🔦 Context
Minor perf improvement
🖥️ Steps to Reproduce
n/a
Version
latest
What browsers are you seeing the problem on?
Chrome, Firefox, Safari, Microsoft Edge
If other, please specify.
No response
What operating system are you using?
n/a
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Metadata
Metadata
Assignees
Labels
No labels