Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): polyfill iterator helper for safari (#8824)

forehalo055fa0a8b4e1
diff --git a/packages/frontend/core/src/bootstrap/polyfill/browser.ts b/packages/frontend/core/src/bootstrap/polyfill/browser.ts
index b84ee578d0..f92ff94f24 100644
--- a/packages/frontend/core/src/bootstrap/polyfill/browser.ts
+++ b/packages/frontend/core/src/bootstrap/polyfill/browser.ts
@@ -1,4 +1,5 @@
import { polyfillDispose } from './dispose';
+import { polyfillIteratorHelpers } from './iterator-helpers';
import { polyfillPromise } from './promise-with-resolvers';
import { polyfillEventLoop } from './request-idle-callback';
import { polyfillResizeObserver } from './resize-observer';
@@ -7,3 +8,4 @@ polyfillResizeObserver();
polyfillEventLoop();
await polyfillPromise();
await polyfillDispose();
+await polyfillIteratorHelpers();
diff --git a/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts b/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts
new file mode 100644
index 0000000000..59ccde6c41
--- /dev/null
+++ b/packages/frontend/core/src/bootstrap/polyfill/iterator-helpers.ts
@@ -0,0 +1,7 @@
+export async function polyfillIteratorHelpers() {
+ if (typeof globalThis['Iterator'] !== 'function') {
+ // @ts-expect-error ignore
+ // https://github.com/zloirock/core-js/blob/master/packages/core-js/proposals/iterator-helpers-stage-3.js
+ await import('core-js/proposals/iterator-helpers-stage-3');
+ }
+}