Skip to content

Commit

Permalink
chore(remix-dev): update default entry.client (remix-run#5749)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcansh authored and fernandojbf committed Mar 21, 2023
1 parent 91c98c4 commit 8a6eb39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .changeset/entry-client-no-ric.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"remix": patch
"@remix-run/dev": patch
---

update entry.client, requestIdleCallback/setTimeout doesn't really do anything more than startTransition.
26 changes: 8 additions & 18 deletions packages/remix-dev/config/defaults/entry.client.react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@ import { RemixBrowser } from "@remix-run/react";
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";

function hydrate() {
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});
}

if (typeof requestIdleCallback === "function") {
requestIdleCallback(hydrate);
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
setTimeout(hydrate, 1);
}
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});

0 comments on commit 8a6eb39

Please sign in to comment.