diff --git a/src/view/components/elements/useAutoIndent.ts b/src/view/components/elements/useAutoIndent.ts index b429cacc..6a037f57 100644 --- a/src/view/components/elements/useAutoIndent.ts +++ b/src/view/components/elements/useAutoIndent.ts @@ -10,12 +10,16 @@ export function useAutoIndent(container: RefObject, deps: any[]) { const [available, setAvailable] = useState(0); const cacheRef = useRef(new Map()); - useResize(() => { - indent.current = INITIAL; - if (container.current) { - setAvailable(container.current.clientWidth); - } - }, []); + useResize( + () => { + indent.current = INITIAL; + if (container.current) { + setAvailable(container.current.clientWidth); + } + }, + [], + true, + ); useLayoutEffect(() => { if (container.current) {