diff --git a/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts b/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts index a8dce01d70be..fce5da9d8da2 100644 --- a/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts +++ b/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts @@ -31,6 +31,10 @@ export function useCodeWordWrap(codeBlockRef: React.RefObject) { setIsCodeScrollable(isScrollable); }, [codeBlockRef]); + useEffect(() => { + updateCodeIsScrollable(); + }, [isEnabled, updateCodeIsScrollable]); + useEffect(() => { updateCodeIsScrollable();