Skip to content

Commit

Permalink
fix(theme-common): prepare usage of useSyncExternalStore compatibilit…
Browse files Browse the repository at this point in the history
…y with React 18 (#8618)
  • Loading branch information
slorber committed Feb 2, 2023
1 parent 883983c commit ce8e55b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/docusaurus-theme-common/src/utils/historyUtils.ts
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 ce8e55b

Please sign in to comment.