Do not build list of available slots when no error #7731
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An error was logged on my website because
Intl.ListFormat
was not available:It seemed the site was accessed using Playwright, an automated browser. (https://github.com/microsoft/playwright, microsoft/playwright#23978).
Out of curiousity, I checked which react-aria code was using
Intl.ListFormat
and it seemed that the code in utils that caused this should not have run, as the list is only needed in case of errors.I refactored the code so the list of available slots is only compiled in case the requested slot is not available. This is a small speed optimization, as there is no longer a new instance of
Intl.ListFormat
on every render.✅ Pull Request Checklist:
📝 Test Instructions:
Intl.ListFormat
.Intl.ListFormat
.