From 045187d8ca55255fb4ddf9eb2a09fde37a8fe3e1 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 2 Feb 2023 13:15:13 +0100 Subject: [PATCH] quick fix of useSyncExternalStore for React 18 support, see https://github.com/facebook/docusaurus/issues/8592 --- packages/docusaurus-theme-common/src/utils/historyUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-common/src/utils/historyUtils.ts b/packages/docusaurus-theme-common/src/utils/historyUtils.ts index a81663feacbf..06b124a229ac 100644 --- a/packages/docusaurus-theme-common/src/utils/historyUtils.ts +++ b/packages/docusaurus-theme-common/src/utils/historyUtils.ts @@ -56,7 +56,11 @@ export function useHistorySelector( selector: (history: History) => Value, ): Value { const history = useHistory(); - return useSyncExternalStore(history.listen, () => selector(history)); + return useSyncExternalStore( + history.listen, + () => selector(history), + () => selector(history), + ); } /**