From 5a14be5432662c061c1b4ce67857e9435ba5a3de Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Thu, 21 Apr 2022 12:24:19 +0200 Subject: [PATCH] codeWordWrap toggling can impact scroll => trigger update --- packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts | 4 ++++ 1 file changed, 4 insertions(+) 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();