Skip to content

Commit ce8e55b

Browse files
committed
fix(theme-common): prepare usage of useSyncExternalStore compatibility with React 18 (#8618)
1 parent 883983c commit ce8e55b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/docusaurus-theme-common/src/utils/historyUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ export function useHistorySelector<Value>(
5656
selector: (history: History<unknown>) => Value,
5757
): Value {
5858
const history = useHistory();
59-
return useSyncExternalStore(history.listen, () => selector(history));
59+
return useSyncExternalStore(
60+
history.listen,
61+
() => selector(history),
62+
() => selector(history),
63+
);
6064
}
6165

6266
/**

0 commit comments

Comments
 (0)