mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-16 17:10:12 +00:00
23 lines
525 B
TypeScript
23 lines
525 B
TypeScript
import { RemixBrowser } from "@remix-run/react";
|
|
import { startTransition, StrictMode } from "react";
|
|
import { hydrateRoot } from "react-dom/client";
|
|
|
|
const hydrate = () => {
|
|
startTransition(() => {
|
|
hydrateRoot(
|
|
document,
|
|
<StrictMode>
|
|
<RemixBrowser />
|
|
</StrictMode>
|
|
);
|
|
});
|
|
};
|
|
|
|
if (window.requestIdleCallback) {
|
|
window.requestIdleCallback(hydrate);
|
|
} else {
|
|
// Safari doesn't support requestIdleCallback
|
|
// https://caniuse.com/requestidlecallback
|
|
window.setTimeout(hydrate, 1);
|
|
}
|