chore: backport retro compatible commits for the Docusaurus v2.3.1 release (#8621)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: Sébastien Castiel <sebastien@castiel.me>
This commit is contained in:
Sébastien Lorber 2023-02-03 15:04:03 +01:00 committed by GitHub
parent c84d779627
commit c60387dbe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 296 additions and 212 deletions

View file

@ -222,7 +222,10 @@ export function useScrollPositionBlocker(): {
);
useLayoutEffect(() => {
nextLayoutEffectCallbackRef.current?.();
// Queuing permits to restore scroll position after all useLayoutEffect
// have run, and yet preserve the sync nature of the scroll restoration
// See https://github.com/facebook/docusaurus/issues/8625
queueMicrotask(() => nextLayoutEffectCallbackRef.current?.());
});
return {