Skip to content

Commit

Permalink
quick fix of useSyncExternalStore for React 18 support, see #8592
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Feb 2, 2023
1 parent 1bff83c commit 045187d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/docusaurus-theme-common/src/utils/historyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export function useHistorySelector<Value>(
selector: (history: History<unknown>) => Value,
): Value {
const history = useHistory();
return useSyncExternalStore(history.listen, () => selector(history));
return useSyncExternalStore(
history.listen,
() => selector(history),
() => selector(history),
);
}

/**
Expand Down

0 comments on commit 045187d

Please sign in to comment.