forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encapsulate routing and initial hydration (vercel#33875)
* Encapsulate initial rendering * Run dev code before rendering * Fix call * Try reverting last change, fixing call
- Loading branch information
Showing
4 changed files
with
27 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This function is used to remove Next.js' no-FOUC styles workaround for using | ||
// `style-loader` in development. It must be called before hydration, or else | ||
// rendering won't have the correct computed values in effects. | ||
export function displayContent(): Promise<void> { | ||
return new Promise((resolve) => { | ||
;(window.requestAnimationFrame || setTimeout)(function () { | ||
for ( | ||
var x = document.querySelectorAll('[data-next-hide-fouc]'), | ||
i = x.length; | ||
i--; | ||
|
||
) { | ||
x[i].parentNode!.removeChild(x[i]) | ||
} | ||
resolve() | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters