mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-26 19:25:47 +03:00
Preload IntlSegmenter polyfill if needed
This commit is contained in:
parent
5246af4ae9
commit
ebd9f05f69
1 changed files with 9 additions and 0 deletions
|
@ -6,6 +6,15 @@ import Loader from './loader';
|
|||
|
||||
const supportsIntlSegmenter = !shouldPolyfill();
|
||||
|
||||
// Preload IntlSegmenter
|
||||
setTimeout(() => {
|
||||
queueMicrotask(() => {
|
||||
if (!supportsIntlSegmenter) {
|
||||
import('@formatjs/intl-segmenter/polyfill-force').catch(() => {});
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
export default function IntlSegmenterSuspense({ children }) {
|
||||
if (supportsIntlSegmenter) {
|
||||
return <Suspense fallback={<Loader />}>{children}</Suspense>;
|
||||
|
|
Loading…
Reference in a new issue