Auto-scroll the left pane less frequently
This commit is contained in:
parent
3d5f30560d
commit
c97bb0feee
5 changed files with 43 additions and 59 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue