Auto-scroll the left pane less frequently

This commit is contained in:
Evan Hahn 2021-03-18 19:22:17 -05:00 committed by Josh Perez
parent 3d5f30560d
commit c97bb0feee
5 changed files with 43 additions and 59 deletions

View file

@ -9,6 +9,7 @@ import React, {
ReactNode,
} from 'react';
import { usePrevious } from '../util/hooks';
import { scrollToBottom } from '../util/scrollToBottom';
type PropsType = {
@ -19,9 +20,7 @@ export const ContactPills: FunctionComponent<PropsType> = ({ children }) => {
const elRef = useRef<null | HTMLDivElement>(null);
const childCount = Children.count(children);
const previousChildCountRef = useRef<number>(childCount);
const previousChildCount = previousChildCountRef.current;
previousChildCountRef.current = childCount;
const previousChildCount = usePrevious(0, childCount);
useEffect(() => {
const hasAddedNewChild = childCount > previousChildCount;