diff --git a/apps/admin/app/entry.client.tsx b/apps/admin/app/entry.client.tsx index 9c665ede072..5437d71bcb5 100644 --- a/apps/admin/app/entry.client.tsx +++ b/apps/admin/app/entry.client.tsx @@ -8,6 +8,19 @@ import { startTransition, StrictMode } from "react"; import { hydrateRoot } from "react-dom/client"; import { HydratedRouter } from "react-router/dom"; +if (typeof window !== "undefined" && typeof window.requestIdleCallback !== "function") { + window.requestIdleCallback = (cb: any) => { + const start = Date.now(); + return setTimeout(() => { + cb({ + didTimeout: false, + timeRemaining: () => Math.max(0, 50 - (Date.now() - start)), + }); + }, 1) as any; + }; + window.cancelIdleCallback = (id: any) => clearTimeout(id); +} + startTransition(() => { hydrateRoot( document, diff --git a/apps/space/app/entry.client.tsx b/apps/space/app/entry.client.tsx index 9c665ede072..5437d71bcb5 100644 --- a/apps/space/app/entry.client.tsx +++ b/apps/space/app/entry.client.tsx @@ -8,6 +8,19 @@ import { startTransition, StrictMode } from "react"; import { hydrateRoot } from "react-dom/client"; import { HydratedRouter } from "react-router/dom"; +if (typeof window !== "undefined" && typeof window.requestIdleCallback !== "function") { + window.requestIdleCallback = (cb: any) => { + const start = Date.now(); + return setTimeout(() => { + cb({ + didTimeout: false, + timeRemaining: () => Math.max(0, 50 - (Date.now() - start)), + }); + }, 1) as any; + }; + window.cancelIdleCallback = (id: any) => clearTimeout(id); +} + startTransition(() => { hydrateRoot( document, diff --git a/apps/web/app/entry.client.tsx b/apps/web/app/entry.client.tsx index 8dc2a587717..c2a32a04a70 100644 --- a/apps/web/app/entry.client.tsx +++ b/apps/web/app/entry.client.tsx @@ -12,6 +12,18 @@ import polyfills from "@/lib/polyfills"; void polyfills; +if (typeof window !== "undefined" && typeof window.requestIdleCallback !== "function") { + window.requestIdleCallback = (cb: any) => { + const start = Date.now(); + return setTimeout(() => { + cb({ + didTimeout: false, + timeRemaining: () => Math.max(0, 50 - (Date.now() - start)), + }); + }, 1) as any; + }; + window.cancelIdleCallback = (id: any) => clearTimeout(id); +} startTransition(() => { hydrateRoot( document,