Skip to content

Commit 9e2e57c

Browse files
authored
Merge pull request #14940 from artsy/damassi/optimize-hydration
chore(performance): Optimize rehydration
2 parents 2561d81 + 98129ab commit 9e2e57c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/client.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { setupClientRouter } from "System/Router/clientRouter"
66
import { setupSentryClient } from "System/Utils/setupSentryClient"
77
import { setupWebVitals } from "System/Utils/setupWebVitals"
88
import { hydrateRoot } from "react-dom/client"
9+
import { startTransition } from "react"
910

1011
setupAnalytics()
1112
setupSentryClient()
@@ -18,10 +19,12 @@ setupWebVitals()
1819
})
1920

2021
loadableReady().then(() => {
21-
hydrateRoot(
22-
document.getElementById("react-root") as HTMLElement,
23-
<ClientRouter />
24-
)
22+
startTransition(() => {
23+
hydrateRoot(
24+
document.getElementById("react-root") as HTMLElement,
25+
<ClientRouter />
26+
)
27+
})
2528
})
2629
})()
2730

0 commit comments

Comments
 (0)